-
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
16 changed files
with
153 additions
and
54 deletions.
There are no files selected for viewing
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
8 changes: 4 additions & 4 deletions
8
...c/components/fullscreen-loading/index.tsx → ...tend/src/components/app-loading/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,16 +1,16 @@ | ||
import { FC } from "react"; | ||
import Loading from "../loading"; | ||
import SectionLoading from "../section-loading"; | ||
|
||
interface Props { | ||
text?: string; | ||
} | ||
|
||
const FullScreenLoading: FC<Props> = ({ text }) => { | ||
const AppLoading: FC<Props> = ({ text }) => { | ||
return ( | ||
<div className="flex h-screen w-screen flex-col items-center justify-center"> | ||
<Loading text={text} /> | ||
<SectionLoading text={text} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FullScreenLoading; | ||
export default AppLoading; |
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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface ShareUrlModel { | ||
id: string; | ||
fullUrl: string; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Button, Table } from "@mantine/core"; | ||
import { useMutation, useQuery } from "@tanstack/react-query"; | ||
|
||
import { FiTrash } from "react-icons/fi"; | ||
import { useApi } from "../../hooks/useApi"; | ||
import { ShareUrlModel } from "./models"; | ||
import DataTableSkeleton from "../../components/skeleton/data-table-skeleton"; | ||
|
||
export default function ShareCodes() { | ||
const { get, del } = useApi(); | ||
|
||
const { data, refetch, isPending } = useQuery({ | ||
queryKey: ["getShareUrls"], | ||
queryFn: () => get<ShareUrlModel[]>("api/v1/share-codes/urls"), | ||
}); | ||
|
||
const deleteMut = useMutation({ | ||
mutationFn: (id: string) => del(`api/v1/share-codes/urls/${id}`), | ||
}); | ||
|
||
return ( | ||
<Table striped highlightOnHover withRowBorders={false}> | ||
<Table.Thead> | ||
<Table.Tr> | ||
<Table.Th>ID</Table.Th> | ||
<Table.Th>URL</Table.Th> | ||
<Table.Th></Table.Th> | ||
</Table.Tr> | ||
</Table.Thead> | ||
<Table.Tbody> | ||
{isPending ? ( | ||
<DataTableSkeleton row={3} col={3} /> | ||
) : ( | ||
data?.map((item) => { | ||
return ( | ||
<Table.Tr key={item.id}> | ||
<Table.Td>{item.id}</Table.Td> | ||
<Table.Td>{item.fullUrl}</Table.Td> | ||
<Table.Td> | ||
<Button | ||
leftSection={<FiTrash size={18} />} | ||
color="red" | ||
onClick={async () => { | ||
await deleteMut.mutateAsync(item.id); | ||
await refetch(); | ||
}} | ||
> | ||
Delete | ||
</Button> | ||
</Table.Td> | ||
</Table.Tr> | ||
); | ||
}) | ||
)} | ||
</Table.Tbody> | ||
</Table> | ||
); | ||
} |
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
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,10 +1,17 @@ | ||
package dto | ||
|
||
type CreateShareUrlDto struct { | ||
Url string `json:"url"` | ||
} | ||
type ( | ||
CreateShareUrlDto struct { | ||
Url string `json:"url"` | ||
} | ||
|
||
type ValidateShareUrlDto struct { | ||
Url string `json:"url"` | ||
Code string `json:"code"` | ||
} | ||
ValidateShareUrlDto struct { | ||
Url string `json:"url"` | ||
Code string `json:"code"` | ||
} | ||
|
||
ShareCodeDto struct { | ||
Id uint `json:"id"` | ||
FullUrl string `json:"fullUrl"` | ||
} | ||
) |
Oops, something went wrong.