-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
52 changes: 48 additions & 4 deletions
52
dashboard/src/views/Projects/Versions/components/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,49 @@ | ||
const AddNewVersionModal = () => { | ||
return <div>AddNewVersion</div>; | ||
}; | ||
import { Delete } from "@mui/icons-material"; | ||
import { Button, Typography } from "@mui/joy"; | ||
import { FC } from "react"; | ||
import { useParams } from "react-router-dom"; | ||
import { useDeleteVersion } from "../../../../api/hooks/useDeleteVersion"; | ||
|
||
|
||
interface VersionTableRowProps { | ||
versionId: number; | ||
versionName: string; | ||
createdAt: string; | ||
} | ||
|
||
export const VersionTableRow: FC<VersionTableRowProps> = ({ | ||
versionId, | ||
versionName, | ||
createdAt, | ||
}) => { | ||
const formatIsoDateToLocaleString = (isoDate: string) => { | ||
return new Date(isoDate).toLocaleString(); | ||
}; | ||
|
||
const { projectId } = useParams(); | ||
const { mutate: deleteVersion } = useDeleteVersion(projectId, versionId); | ||
|
||
export default AddNewVersionModal; | ||
const createdAtDate = formatIsoDateToLocaleString(createdAt); | ||
|
||
return ( | ||
<tr> | ||
<td style={{ paddingLeft: "1.5rem" }}> | ||
<Typography level="body-xs">{versionName}</Typography> | ||
</td> | ||
|
||
<td style={{ paddingLeft: "0.5rem" }}> | ||
<Typography level="body-xs">{createdAtDate}</Typography> | ||
</td> | ||
|
||
<td | ||
style={{ | ||
textAlign: "end", | ||
padding: "0.5rem 5rem", | ||
verticalAlign: "center", | ||
}} | ||
> | ||
<Button sx={{ mb: "0.5rem", backgroundColor: '#0078ff' }} onClick={() => deleteVersion()}>Delete <Delete /></Button> | ||
</td> | ||
</tr> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters