Skip to content

Commit

Permalink
prepare to add files to server
Browse files Browse the repository at this point in the history
  • Loading branch information
jerem1508 committed Sep 25, 2024
1 parent 285f732 commit 5be002f
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions client/src/pages/admin/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { useParams } from "react-router-dom";
import { useQuery } from "@tanstack/react-query";
import { useState } from "react";

import { queryClient } from "../../main";

const { VITE_APP_SERVER_URL } = import.meta.env;
Expand Down Expand Up @@ -43,10 +44,14 @@ export default function Dashboard() {
);
}

// const addCollection = ({ dashboardId, collectionId }) => {
// setSelected({ dashboardId, collectionId });
// setIsOpen(true);
// };
const addCollection = ({ collectionId }) => {
// setSelected({ dashboardId, collectionId });
setSelectedCollection({
collectionId: collectionId,
newCollectionId: `${collectionId}_${new Date().getTime().toString()}`,
});
setIsOpen(true);
};

const setCurrentVersion = (collectionId, versionId) => {
fetch(`${VITE_APP_SERVER_URL}/admin/set-current-version`, {
Expand All @@ -68,15 +73,17 @@ export default function Dashboard() {
});
};

console.log(isOpen);

return (
<Container>
<Row>
<Col>Liste des collections/tables du dashboard {dashboardId}</Col>
</Row>
<ul>
{data
.find((dashboard) => dashboard?.id === dashboardId)
?.data.map((collection) => (
.find((dashboard) => dashboard.id === dashboardId)
.data.map((collection) => (
<li key={collection.id}>
<div className="fr-card fr-my-2w fr-p-3w">
<Title as="h2" look="h6">
Expand All @@ -88,17 +95,9 @@ export default function Dashboard() {
variant="tertiary"
icon="file-add-line"
onClick={() => {
setSelectedCollection({
addCollection({
collectionId: collection.id,
newCollectionId: `${collection.id}_${new Date()
.getTime()
.toString()}`,
});
setIsOpen(true);
// addCollection({
// dashboardId,
// collectionId: collection.id,
// });
}}
/>
</Title>
Expand Down Expand Up @@ -159,7 +158,7 @@ export default function Dashboard() {
</li>
))}
</ul>
<Modal isOpen={isOpen} hide={() => setIsOpen(false)} size="lg">
<Modal isOpen={isOpen} hide={() => setIsOpen(false)} size="lg" id="">
<ModalTitle>{dashboardId}</ModalTitle>
<ModalContent>
Ajout d'une nouvelle version à la collection{" "}
Expand Down

0 comments on commit 5be002f

Please sign in to comment.