Refactor compliance page files page

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-01-28 18:37:44 +04:00
parent 36a936fcf4
commit c74631ae54
24 changed files with 1972 additions and 1335 deletions

View File

@@ -1,79 +0,0 @@
import { graphql } from "relay-runtime";
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
export const createTrustCenterFileMutation = graphql`
mutation TrustCenterFileGraphCreateMutation(
$input: CreateTrustCenterFileInput!
$connections: [ID!]!
) {
createTrustCenterFile(input: $input) {
trustCenterFileEdge @prependEdge(connections: $connections) {
node {
id
name
category
fileUrl
trustCenterVisibility
createdAt
updatedAt
}
}
}
}
`;
export function useCreateTrustCenterFileMutation() {
return useMutationWithToasts(
createTrustCenterFileMutation,
{
successMessage: "File uploaded successfully",
errorMessage: "Failed to upload file",
},
);
}
export const updateTrustCenterFileMutation = graphql`
mutation TrustCenterFileGraphUpdateMutation($input: UpdateTrustCenterFileInput!) {
updateTrustCenterFile(input: $input) {
trustCenterFile {
id
name
category
trustCenterVisibility
updatedAt
}
}
}
`;
export function useUpdateTrustCenterFileMutation() {
return useMutationWithToasts(
updateTrustCenterFileMutation,
{
successMessage: "File updated successfully",
errorMessage: "Failed to update file",
},
);
}
export const deleteTrustCenterFileMutation = graphql`
mutation TrustCenterFileGraphDeleteMutation(
$input: DeleteTrustCenterFileInput!
$connections: [ID!]!
) {
deleteTrustCenterFile(input: $input) {
deletedTrustCenterFileId @deleteEdge(connections: $connections)
}
}
`;
export function useDeleteTrustCenterFileMutation() {
return useMutationWithToasts(
deleteTrustCenterFileMutation,
{
successMessage: "File deleted successfully",
errorMessage: "Failed to delete file",
},
);
}

View File

@@ -40,16 +40,6 @@ export const trustCenterQuery = graphql`
}
}
}
trustCenterFiles(first: 100)
@connection(key: "TrustCenterPage_trustCenterFiles") {
__id
edges {
node {
id
...TrustCenterFilesCardFragment
}
}
}
}
}
}