Add updates in previously implemented pages (#40)

* Add cancel button in deployments status filter

* Add namecheap hyperlink in domain config page

* Add disconnect repo confirm dialog
This commit is contained in:
Nabarun Gogoi 2024-01-08 16:58:58 +05:30 committed by GitHub
parent 198a8ac335
commit 2bd378ada5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 9 deletions

View File

@ -12,7 +12,7 @@ import { DeploymentDetails } from '../../../types/project';
const DEFAULT_FILTER_VALUE: FilterValue = { const DEFAULT_FILTER_VALUE: FilterValue = {
searchedBranch: '', searchedBranch: '',
status: 'All status', status: StatusOptions.ALL_STATUS,
}; };
const DeploymentsTabPanel = () => { const DeploymentsTabPanel = () => {

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { DateRange } from 'react-day-picker'; import { DateRange } from 'react-day-picker';
import { Option, Select } from '@material-tailwind/react'; import { IconButton, Option, Select } from '@material-tailwind/react';
import SearchBar from '../../../SearchBar'; import SearchBar from '../../../SearchBar';
import DatePicker from '../../../DatePicker'; import DatePicker from '../../../DatePicker';
@ -15,7 +15,7 @@ export enum StatusOptions {
export interface FilterValue { export interface FilterValue {
searchedBranch: string; searchedBranch: string;
status: string; status: StatusOptions;
updateAtRange?: DateRange; updateAtRange?: DateRange;
} }
@ -55,14 +55,15 @@ const FilterForm = ({ value, onChange }: FilterFormProps) => {
<div className="col-span-1"> <div className="col-span-1">
<DatePicker mode="range" selected={dateRange} onSelect={setDateRange} /> <DatePicker mode="range" selected={dateRange} onSelect={setDateRange} />
</div> </div>
<div className="col-span-1"> <div className="col-span-1 relative">
<Select <Select
value={selectedStatus} value={selectedStatus}
onChange={(value) => setSelectedStatus(value!)} onChange={(value) => setSelectedStatus(value as StatusOptions)}
placeholder="All status"
> >
{Object.values(StatusOptions).map((status) => ( {Object.values(StatusOptions).map((status) => (
<Option <Option
className={status === selectedStatus ? 'hidden' : ''} className={status === StatusOptions.ALL_STATUS ? 'hidden' : ''}
key={status} key={status}
value={status} value={status}
> >
@ -70,6 +71,17 @@ const FilterForm = ({ value, onChange }: FilterFormProps) => {
</Option> </Option>
))} ))}
</Select> </Select>
{selectedStatus !== StatusOptions.ALL_STATUS && (
<div className="absolute end-1 inset-y-0 my-auto h-8">
<IconButton
onClick={() => setSelectedStatus(StatusOptions.ALL_STATUS)}
className="rounded-full"
size="sm"
>
X
</IconButton>
</div>
)}
</div> </div>
</div> </div>
); );

View File

@ -1,14 +1,18 @@
import React from 'react'; import React, { useState } from 'react';
import { Button, Typography } from '@material-tailwind/react'; import { Button, Typography } from '@material-tailwind/react';
import { RepositoryDetails } from '../../../../types/project'; import { RepositoryDetails } from '../../../../types/project';
import ConfirmDialog from '../../../shared/ConfirmDialog';
const RepoConnectedSection = ({ const RepoConnectedSection = ({
linkedRepo, linkedRepo,
}: { }: {
linkedRepo: RepositoryDetails; linkedRepo: RepositoryDetails;
}) => { }) => {
const [disconnectRepoDialogOpen, setDisconnectRepoDialogOpen] =
useState(false);
return ( return (
<div className="flex gap-4"> <div className="flex gap-4">
<div>^</div> <div>^</div>
@ -19,10 +23,29 @@ const RepoConnectedSection = ({
<Typography variant="small">Connected just now</Typography> <Typography variant="small">Connected just now</Typography>
</div> </div>
<div> <div>
<Button variant="outlined" size="sm"> <Button
onClick={() => setDisconnectRepoDialogOpen(true)}
variant="outlined"
size="sm"
>
^ Disconnect ^ Disconnect
</Button> </Button>
</div> </div>
<ConfirmDialog
dialogTitle="Disconnect repository?"
handleOpen={() => setDisconnectRepoDialogOpen((preVal) => !preVal)}
open={disconnectRepoDialogOpen}
confirmButtonTitle="Yes, confirm disconnect"
handleConfirm={() => {
setDisconnectRepoDialogOpen((preVal) => !preVal);
}}
color="red"
>
<Typography variant="small">
Any data tied to your Git project may become misconfigured. Are you
sure you want to continue?
</Typography>
</ConfirmDialog>
</div> </div>
); );
}; };

View File

@ -10,7 +10,10 @@ const Config = () => {
<div> <div>
<Typography variant="h5">Configure DNS</Typography> <Typography variant="h5">Configure DNS</Typography>
<Typography variant="small"> <Typography variant="small">
Add the following records to your domain Add the following records to your domain.&nbsp;
<a href="https://www.namecheap.com/" target="_blank" rel="noreferrer">
<span className="underline">Go to NameCheap</span> ^
</a>
</Typography> </Typography>
</div> </div>