forked from cerc-io/snowballtools-base
Update instructions and general package cleanup (#29)
* Update root readme and setup depcheck * Use fetched domain data in edit domain dialog box * Use fetched project data in general tab * Rename files in gql-client package --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
committed by
Ashwin Phatak
co-authored by
neeraj
parent
7d54280d5c
commit
d4b0659307
@@ -14,6 +14,8 @@
|
||||
"assert": "^2.1.0",
|
||||
"date-fns": "^3.0.1",
|
||||
"downshift": "^8.2.3",
|
||||
"eslint-config-react-app": "^7.0.1",
|
||||
"gql-client": "^1.0.0",
|
||||
"luxon": "^3.4.4",
|
||||
"react": "^18.2.0",
|
||||
"react-day-picker": "^8.9.1",
|
||||
|
||||
@@ -163,6 +163,7 @@ const DomainCard = ({ domain, repo, project }: DomainCardProps) => {
|
||||
open={editDialogOpen}
|
||||
domain={domain}
|
||||
repo={repo}
|
||||
project={project}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -4,7 +4,10 @@ import { useParams, Link, useOutletContext } from 'react-router-dom';
|
||||
import { Button, Typography } from '@material-tailwind/react';
|
||||
|
||||
import DomainCard from './DomainCard';
|
||||
import { DomainDetails, ProjectsOutletContext } from '../../../../types/project';
|
||||
import {
|
||||
DomainDetails,
|
||||
ProjectsOutletContext,
|
||||
} from '../../../../types/project';
|
||||
|
||||
const Domains = () => {
|
||||
const { id } = useParams();
|
||||
|
||||
@@ -14,8 +14,11 @@ import {
|
||||
Option,
|
||||
} from '@material-tailwind/react';
|
||||
|
||||
import { DomainDetails, RepositoryDetails } from '../../../../types/project';
|
||||
import domains from '../../../../assets/domains.json';
|
||||
import {
|
||||
DomainDetails,
|
||||
ProjectDetails,
|
||||
RepositoryDetails,
|
||||
} from '../../../../types/project';
|
||||
|
||||
const DEFAULT_REDIRECT_OPTIONS = ['none'];
|
||||
|
||||
@@ -24,6 +27,7 @@ interface EditDomainDialogProp {
|
||||
handleOpen: () => void;
|
||||
domain: DomainDetails;
|
||||
repo: RepositoryDetails;
|
||||
project: ProjectDetails;
|
||||
}
|
||||
|
||||
const EditDomainDialog = ({
|
||||
@@ -31,6 +35,7 @@ const EditDomainDialog = ({
|
||||
handleOpen,
|
||||
domain,
|
||||
repo,
|
||||
project,
|
||||
}: EditDomainDialogProp) => {
|
||||
const getRedirectUrl = (domain: DomainDetails) => {
|
||||
const domainArr = domain.name.split('www.');
|
||||
@@ -43,6 +48,12 @@ const EditDomainDialog = ({
|
||||
return redirectUrl;
|
||||
};
|
||||
|
||||
const domains = project.deployments
|
||||
.filter((deployment: any) => {
|
||||
return deployment.domain != null;
|
||||
})
|
||||
.map((deployment: any) => deployment.domain);
|
||||
|
||||
const redirectOptions = useMemo(() => {
|
||||
const redirectUrl = getRedirectUrl(domain);
|
||||
return [...DEFAULT_REDIRECT_OPTIONS, redirectUrl];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import React, { useState, useMemo } from 'react';
|
||||
import { Link, useOutletContext, useParams } from 'react-router-dom';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import toast from 'react-hot-toast';
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
|
||||
import DeleteProjectDialog from './DeleteProjectDialog';
|
||||
import ConfirmDialog from '../../../shared/ConfirmDialog';
|
||||
import { ProjectsOutletContext } from '../../../../types/project';
|
||||
|
||||
const PROJECT_ID = '62f87575-7a2b-4951-8156-9f9821j380d';
|
||||
const TEAMS = ['Airfoil'];
|
||||
@@ -33,6 +34,13 @@ const CopyIcon = ({ value }: { value: string }) => {
|
||||
};
|
||||
|
||||
const GeneralTabPanel = () => {
|
||||
const { id } = useParams();
|
||||
const { projects } = useOutletContext<ProjectsOutletContext>();
|
||||
|
||||
const currProject = useMemo(() => {
|
||||
return projects.find((project: any) => project.id === id);
|
||||
}, [id]);
|
||||
|
||||
const {
|
||||
handleSubmit: handleTransfer,
|
||||
control,
|
||||
@@ -53,8 +61,8 @@ const GeneralTabPanel = () => {
|
||||
|
||||
const { handleSubmit, register } = useForm({
|
||||
defaultValues: {
|
||||
appName: 'iglootools',
|
||||
description: '',
|
||||
appName: currProject?.name,
|
||||
description: currProject?.description,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ const ProjectSearch = () => {
|
||||
name: '',
|
||||
value: '',
|
||||
},
|
||||
isRedirectedto: deployment.domain.isRedirected,
|
||||
}
|
||||
: null,
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@ export interface ProjectDetails {
|
||||
name: string;
|
||||
title: string;
|
||||
organization: string;
|
||||
description: string;
|
||||
url: string;
|
||||
domain: string | null;
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user