-
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.
Improved user file access on client components using React Context
- Loading branch information
1 parent
91e4362
commit 071caa5
Showing
6 changed files
with
64 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Composant de gestion des données de stockage de l'utilisateur. | ||
// | ||
|
||
"use client"; | ||
|
||
import type { FileAttributes } from "@/interfaces/File"; | ||
import { createContext, type Dispatch, type SetStateAction } from "react"; | ||
|
||
export const StorageContext = createContext<{ | ||
files: FileAttributes[]; | ||
setFiles: Dispatch<SetStateAction<FileAttributes[]>>; | ||
}>( { | ||
// Liste des fichiers utilisateurs. | ||
files: [], | ||
|
||
// Définition de la liste des fichiers utilisateurs. | ||
setFiles: () => | ||
{} | ||
} ); |
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,22 @@ | ||
// | ||
// Interface des attributs des fichiers utilisateurs. | ||
// | ||
export interface FileAttributes { | ||
// Identifiant unique du fichier. | ||
id: number; | ||
|
||
// Nom original du fichier. | ||
name: string; | ||
|
||
// Type MIME du fichier. | ||
type: string; | ||
|
||
// Taille du fichier en octets. | ||
size: number; | ||
|
||
// Date de création du fichier. | ||
date: string; | ||
|
||
// Statut de partage du fichier. | ||
status: "public" | "private" | "shared"; | ||
} |