@capytale/meta-player 0.9.10 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/.prettierrc.json +4 -4
  2. package/LICENSE +674 -674
  3. package/README.md +12 -12
  4. package/eslint.config.js +28 -28
  5. package/index.html +15 -15
  6. package/package.json +60 -60
  7. package/public/themes/lara-dark-blue/theme.css +7015 -7015
  8. package/public/themes/lara-light-blue/theme.css +7005 -7005
  9. package/src/App.tsx +145 -140
  10. package/src/AppRedux.css +39 -39
  11. package/src/MetaPlayer.tsx +168 -168
  12. package/src/activityJs.ts +7 -7
  13. package/src/app/createAppSlice.ts +6 -6
  14. package/src/app/hooks.ts +12 -12
  15. package/src/app/store.ts +52 -52
  16. package/src/app.module.scss +80 -80
  17. package/src/demo.tsx +87 -87
  18. package/src/external/prime.ts +5 -5
  19. package/src/features/activityData/ExitWarning.ts +28 -28
  20. package/src/features/activityData/IsAntiCheatExitDetectionDisabledSetter.tsx +19 -19
  21. package/src/features/activityData/IsDirtySetter.tsx +17 -17
  22. package/src/features/activityData/MetaPlayerOptionsSetter.tsx +41 -41
  23. package/src/features/activityData/activityDataSlice.ts +255 -255
  24. package/src/features/activityData/activityJsData.ts +90 -90
  25. package/src/features/activityData/hooks.ts +39 -39
  26. package/src/features/activityData/metaPlayerOptions.ts +23 -23
  27. package/src/features/activityData/uiState.ts +20 -20
  28. package/src/features/activityJS/ActivityJSProvider.tsx +362 -350
  29. package/src/features/activityJS/AfterResetAction.tsx +23 -23
  30. package/src/features/activityJS/AfterSaveAction.tsx +23 -23
  31. package/src/features/activityJS/BeforeResetAction.tsx +23 -23
  32. package/src/features/activityJS/BeforeSaveAction.tsx +23 -23
  33. package/src/features/activityJS/Saver.tsx +167 -167
  34. package/src/features/activityJS/hooks.ts +85 -85
  35. package/src/features/activityJS/internal-hooks.ts +96 -96
  36. package/src/features/activityJS/saverSlice.ts +96 -96
  37. package/src/features/activitySettings/ActivitySettingsSetter.tsx +21 -21
  38. package/src/features/activitySettings/hooks.ts +12 -12
  39. package/src/features/activitySettings/index.tsx +43 -43
  40. package/src/features/activitySettings/store.ts +108 -108
  41. package/src/features/activitySettings/style.module.scss +8 -8
  42. package/src/features/activitySettings/types.ts +140 -140
  43. package/src/features/activitySettings/ui.tsx +299 -299
  44. package/src/features/functionalities/AttachedFilesFunctionality.ts +23 -23
  45. package/src/features/functionalities/PreviewDialog.tsx +83 -83
  46. package/src/features/functionalities/functionalitiesSlice.ts +98 -98
  47. package/src/features/functionalities/hooks.ts +70 -70
  48. package/src/features/layout/hooks.ts +7 -7
  49. package/src/features/layout/layoutSlice.ts +93 -93
  50. package/src/features/navbar/activity-info/index.tsx +54 -54
  51. package/src/features/navbar/activity-info/style.module.scss +38 -38
  52. package/src/features/navbar/activity-menu/ActivityQuickActions.tsx +89 -57
  53. package/src/features/navbar/activity-menu/index.tsx +154 -154
  54. package/src/features/navbar/activity-menu/style.module.scss +7 -7
  55. package/src/features/navbar/capytale-menu/CloneDialog.tsx +75 -75
  56. package/src/features/navbar/capytale-menu/Countdown.tsx +313 -313
  57. package/src/features/navbar/capytale-menu/CountdownAndSaveButton.tsx +129 -125
  58. package/src/features/navbar/capytale-menu/index.tsx +260 -260
  59. package/src/features/navbar/capytale-menu/style.module.scss +8 -8
  60. package/src/features/navbar/capytale-menu/useRemainingTimeMs.tsx +32 -32
  61. package/src/features/navbar/index.tsx +39 -39
  62. package/src/features/navbar/navbarSlice.ts +79 -79
  63. package/src/features/navbar/preview-navbar/index.tsx +18 -0
  64. package/src/features/navbar/preview-navbar/style.module.scss +17 -0
  65. package/src/features/navbar/review-navbar/GradingNav.tsx +128 -128
  66. package/src/features/navbar/review-navbar/index.tsx +18 -18
  67. package/src/features/navbar/review-navbar/style.module.scss +22 -22
  68. package/src/features/navbar/sidebars/ActivitySidebarActions.tsx +57 -57
  69. package/src/features/navbar/sidebars/AttachedFilesSidebarContent.module.scss +43 -43
  70. package/src/features/navbar/sidebars/AttachedFilesSidebarContent.tsx +181 -181
  71. package/src/features/navbar/sidebars/SettingsSidebarContent.tsx +192 -192
  72. package/src/features/navbar/sidebars/style.module.scss +15 -15
  73. package/src/features/navbar/student-utils.ts +11 -11
  74. package/src/features/navbar/style.module.scss +65 -65
  75. package/src/features/pedago/InstructionsEditor.tsx +104 -102
  76. package/src/features/pedago/PdfEditor.tsx +91 -91
  77. package/src/features/pedago/PedagoCommands.tsx +378 -378
  78. package/src/features/pedago/SharedNotesEditor.tsx +144 -144
  79. package/src/features/pedago/hooks.ts +108 -108
  80. package/src/features/pedago/index.tsx +205 -205
  81. package/src/features/pedago/style.module.scss +233 -233
  82. package/src/features/theming/ThemeSwitcher.tsx +51 -51
  83. package/src/features/theming/hooks.ts +6 -6
  84. package/src/features/theming/themingSlice.ts +93 -93
  85. package/src/features/toast.tsx +38 -38
  86. package/src/hooks/index.ts +55 -16
  87. package/src/index.css +132 -132
  88. package/src/index.ts +93 -92
  89. package/src/logo.svg +1 -1
  90. package/src/my_json_data.js +4146 -4146
  91. package/src/settings.ts +6 -6
  92. package/src/types.ts +8 -8
  93. package/src/utils/ButtonDoubleIcon.tsx +35 -35
  94. package/src/utils/CardSelector.tsx +41 -41
  95. package/src/utils/ErrorBoundary.tsx +41 -41
  96. package/src/utils/PopupButton.tsx +134 -134
  97. package/src/utils/activity.ts +8 -8
  98. package/src/utils/breakpoints.ts +4 -4
  99. package/src/utils/capytale.ts +10 -10
  100. package/src/utils/clipboard.ts +11 -11
  101. package/src/utils/download.ts +7 -7
  102. package/src/utils/equality.ts +32 -32
  103. package/src/utils/server-clock.ts +42 -42
  104. package/src/utils/style.module.scss +45 -45
  105. package/src/utils/useFullscreen.ts +65 -65
  106. package/src/vite-env.d.ts +1 -1
  107. package/src/zustandStore.ts +66 -0
  108. package/tsconfig.json +28 -28
  109. package/tsconfig.node.json +9 -9
  110. package/vite.config.ts +11 -11
@@ -1,57 +1,57 @@
1
- import { FC, useEffect } from "react";
2
- import { useAppDispatch, useAppSelector } from "../../../app/hooks";
3
- import {
4
- QuickAction,
5
- selectSidebarActions,
6
- setSidebarActions,
7
- usePerformQuickAction,
8
- } from "../navbarSlice";
9
- import { Button } from "primereact/button";
10
- import settings from "../../../settings";
11
-
12
- const ActivitySidebarActions: FC<{}> = () => {
13
- const sidebarActions = useAppSelector(selectSidebarActions);
14
- const performQuickAction = usePerformQuickAction();
15
- return (
16
- <>
17
- {sidebarActions.map((action) => (
18
- <Button
19
- aria-label={action.title}
20
- key={action.title}
21
- severity="secondary"
22
- size="small"
23
- icon={action.icon}
24
- onClick={() => {
25
- performQuickAction(action);
26
- }}
27
- outlined
28
- label={action.title}
29
- tooltipOptions={{
30
- position: "left",
31
- showDelay: settings.TOOLTIP_SHOW_DELAY,
32
- }}
33
- />
34
- ))}
35
- </>
36
- );
37
- };
38
-
39
- type ActivitySidebarActionsSetterProps = {
40
- actions: QuickAction[];
41
- };
42
-
43
- export const ActivitySidebarActionsSetter: FC<
44
- ActivitySidebarActionsSetterProps
45
- > = (props) => {
46
- const dispatch = useAppDispatch();
47
- useEffect(() => {
48
- dispatch(setSidebarActions(props.actions));
49
- return () => {
50
- dispatch(setSidebarActions([]));
51
- };
52
- }, [props.actions]);
53
-
54
- return <></>;
55
- };
56
-
57
- export default ActivitySidebarActions;
1
+ import { FC, useEffect } from "react";
2
+ import { useAppDispatch, useAppSelector } from "../../../app/hooks";
3
+ import {
4
+ QuickAction,
5
+ selectSidebarActions,
6
+ setSidebarActions,
7
+ usePerformQuickAction,
8
+ } from "../navbarSlice";
9
+ import { Button } from "primereact/button";
10
+ import settings from "../../../settings";
11
+
12
+ const ActivitySidebarActions: FC<{}> = () => {
13
+ const sidebarActions = useAppSelector(selectSidebarActions);
14
+ const performQuickAction = usePerformQuickAction();
15
+ return (
16
+ <>
17
+ {sidebarActions.map((action) => (
18
+ <Button
19
+ aria-label={action.title}
20
+ key={action.title}
21
+ severity="secondary"
22
+ size="small"
23
+ icon={action.icon}
24
+ onClick={() => {
25
+ performQuickAction(action);
26
+ }}
27
+ outlined
28
+ label={action.title}
29
+ tooltipOptions={{
30
+ position: "left",
31
+ showDelay: settings.TOOLTIP_SHOW_DELAY,
32
+ }}
33
+ />
34
+ ))}
35
+ </>
36
+ );
37
+ };
38
+
39
+ type ActivitySidebarActionsSetterProps = {
40
+ actions: QuickAction[];
41
+ };
42
+
43
+ export const ActivitySidebarActionsSetter: FC<
44
+ ActivitySidebarActionsSetterProps
45
+ > = (props) => {
46
+ const dispatch = useAppDispatch();
47
+ useEffect(() => {
48
+ dispatch(setSidebarActions(props.actions));
49
+ return () => {
50
+ dispatch(setSidebarActions([]));
51
+ };
52
+ }, [props.actions]);
53
+
54
+ return <></>;
55
+ };
56
+
57
+ export default ActivitySidebarActions;
@@ -1,43 +1,43 @@
1
- .sidebarContent {
2
- height: 100%;
3
- overflow-y: auto;
4
- display: flex;
5
- flex-direction: column;
6
- }
7
-
8
- .attachedFiles {
9
- margin: 4px 0;
10
- flex-grow: 1;
11
- flex-shrink: 1;
12
- }
13
-
14
- .fileRow {
15
- display: flex;
16
- align-items: center;
17
- }
18
-
19
- .fileInteraction {
20
- flex-shrink: 1;
21
- flex-grow: 1;
22
- padding-left: 0.2rem;
23
- padding-right: 0.2rem;
24
- & :global(.p-button-label) {
25
- text-align: left;
26
- text-overflow: ellipsis;
27
- overflow-x: hidden;
28
- font-size: 0.8rem;
29
- }
30
- }
31
-
32
- .fileSmallInteraction {
33
- flex-shrink: 0;
34
- flex-grow: 0;
35
- }
36
-
37
- .uploadFilesButtonContainer {
38
- flex-shrink: 0;
39
- flex-grow: 0;
40
- & > * {
41
- width: 100%;
42
- }
43
- }
1
+ .sidebarContent {
2
+ height: 100%;
3
+ overflow-y: auto;
4
+ display: flex;
5
+ flex-direction: column;
6
+ }
7
+
8
+ .attachedFiles {
9
+ margin: 4px 0;
10
+ flex-grow: 1;
11
+ flex-shrink: 1;
12
+ }
13
+
14
+ .fileRow {
15
+ display: flex;
16
+ align-items: center;
17
+ }
18
+
19
+ .fileInteraction {
20
+ flex-shrink: 1;
21
+ flex-grow: 1;
22
+ padding-left: 0.2rem;
23
+ padding-right: 0.2rem;
24
+ & :global(.p-button-label) {
25
+ text-align: left;
26
+ text-overflow: ellipsis;
27
+ overflow-x: hidden;
28
+ font-size: 0.8rem;
29
+ }
30
+ }
31
+
32
+ .fileSmallInteraction {
33
+ flex-shrink: 0;
34
+ flex-grow: 0;
35
+ }
36
+
37
+ .uploadFilesButtonContainer {
38
+ flex-shrink: 0;
39
+ flex-grow: 0;
40
+ & > * {
41
+ width: 100%;
42
+ }
43
+ }
@@ -1,181 +1,181 @@
1
- import { FC } from "react";
2
- import {
3
- useAttachedFiles,
4
- usePreviewImageFile,
5
- usePreviewTextFile,
6
- } from "../../functionalities/hooks";
7
- import { useAppSelector } from "../../../app/hooks";
8
- import {
9
- AttachedFileData,
10
- selectAttachedFilesOptions,
11
- } from "../../functionalities/functionalitiesSlice";
12
- import { Button } from "primereact/button";
13
-
14
- import styles from "./AttachedFilesSidebarContent.module.scss";
15
- import { copyToClipboard } from "../../../utils/clipboard";
16
- import { downloadFile } from "../../../utils/download";
17
- import { useFileUpload } from "use-file-upload";
18
- import mime from "mime";
19
- import { useToast } from "../../toast";
20
-
21
- const AttachedFilesSidebarContent: FC = () => {
22
- const filesData = useAttachedFiles();
23
- const attachedFilesOptions = useAppSelector(selectAttachedFilesOptions);
24
- const [_, selectFile] = useFileUpload();
25
-
26
- return (
27
- <div className={styles.sidebarContent}>
28
- <div className={styles.attachedFiles}>
29
- {filesData.map((file) => (
30
- <AttachedFileLinks key={file.name} fileData={file} />
31
- ))}
32
- </div>
33
- {attachedFilesOptions.uploadTemporaryFiles && (
34
- <div className={styles.uploadFilesButtonContainer}>
35
- <Button
36
- aria-label="Ajouter fichier temporaire"
37
- icon="pi pi-upload"
38
- label={
39
- attachedFilesOptions.uploadTemporaryFiles?.uploadButtonLabel ||
40
- "Ajouter fichier temporaire"
41
- }
42
- onClick={() => {
43
- selectFile(
44
- {
45
- multiple: attachedFilesOptions.uploadTemporaryFiles?.multiple,
46
- accept:
47
- attachedFilesOptions.uploadTemporaryFiles?.mimeTypes?.join(
48
- ",",
49
- ) || undefined,
50
- },
51
- (filesOrFiles) => {
52
- if (Array.isArray(filesOrFiles)) {
53
- attachedFilesOptions.uploadTemporaryFiles?.handler(
54
- filesOrFiles,
55
- );
56
- } else {
57
- /* Deconstructing the object here so that if there is a
58
- bug, the error will be caught here and not in the handler */
59
- const { source, name, size, file } = filesOrFiles;
60
- attachedFilesOptions.uploadTemporaryFiles?.handler([
61
- { source, name, size, file },
62
- ]);
63
- }
64
- },
65
- );
66
- }}
67
- className={styles.uploadButton}
68
- />
69
- </div>
70
- )}
71
- </div>
72
- );
73
- };
74
-
75
- const AttachedFileLinks: FC<{ fileData: AttachedFileData }> = ({
76
- fileData,
77
- }) => {
78
- const attachedFilesOptions = useAppSelector(selectAttachedFilesOptions);
79
- const toast = useToast();
80
- const previewTextFile = usePreviewTextFile();
81
- const previewImageFile = usePreviewImageFile();
82
-
83
- return (
84
- <div className={styles.fileRow}>
85
- <Button
86
- label={fileData.name}
87
- severity={fileData.isTemporary ? "warning" : "secondary"}
88
- disabled={fileData.interactMode === "none"}
89
- onClick={async () => {
90
- if (fileData.interactMode === "custom") {
91
- attachedFilesOptions.customHandlers?.interactWithFile?.(fileData);
92
- } else if (fileData.interactMode === "download") {
93
- window.open(fileData.urlOrId, "_blank")?.focus();
94
- } else if (fileData.interactMode === "preview") {
95
- const mimeType = mime.getType(fileData.name);
96
- if (
97
- mimeType?.startsWith("text") ||
98
- mimeType === "application/json"
99
- ) {
100
- // fetch file content
101
- const response = await fetch(fileData.urlOrId);
102
- const content = await response.text();
103
- previewTextFile(fileData.name, content);
104
- } else if (mimeType?.startsWith("image")) {
105
- previewImageFile(fileData.name, fileData.urlOrId);
106
- } else {
107
- toast.show({
108
- severity: "info",
109
- summary: `Impossible de prévisualiser {fileData.name}`,
110
- detail: `Aperçu non disponible pour ce type de fichier (${mimeType})`,
111
- life: 3000,
112
- });
113
- }
114
- }
115
- }}
116
- className={styles.fileInteraction}
117
- text
118
- />
119
- {fileData.downloadMode !== "none" && (
120
- <Button
121
- icon="pi pi-download"
122
- severity="secondary"
123
- onClick={() => {
124
- if (fileData.downloadMode === "custom") {
125
- attachedFilesOptions.customHandlers?.downloadFile?.(fileData);
126
- return;
127
- } else if (fileData.downloadMode === "default") {
128
- downloadFile(fileData.urlOrId, fileData.name);
129
- toast.show({
130
- severity: "success",
131
- summary: "Téléchargement lancé",
132
- detail: fileData.name,
133
- life: 3000,
134
- });
135
- }
136
- }}
137
- className={styles.fileSmallInteraction}
138
- text
139
- />
140
- )}
141
- {fileData.copyLinkMode !== "none" && (
142
- <Button
143
- icon="pi pi-link"
144
- severity="secondary"
145
- onClick={() => {
146
- if (fileData.copyLinkMode === "custom") {
147
- attachedFilesOptions.customHandlers?.copyFileLink?.(fileData);
148
- return;
149
- } else if (fileData.copyLinkMode === "default") {
150
- // copy link to clipboard
151
- copyToClipboard(fileData.urlOrId, (success, error) => {
152
- if (success) {
153
- toast.show({
154
- severity: "success",
155
- summary: "Lien copié",
156
- detail: fileData.name,
157
- life: 3000,
158
- });
159
- } else {
160
- toast.show({
161
- severity: "error",
162
- summary: "Erreur lors de la copie du lien",
163
- detail: error,
164
- life: 5000,
165
- });
166
- }
167
- });
168
- }
169
- }}
170
- style={{
171
- flexGrow: 0,
172
- flexShrink: 0,
173
- }}
174
- text
175
- />
176
- )}
177
- </div>
178
- );
179
- };
180
-
181
- export default AttachedFilesSidebarContent;
1
+ import { FC } from "react";
2
+ import {
3
+ useAttachedFiles,
4
+ usePreviewImageFile,
5
+ usePreviewTextFile,
6
+ } from "../../functionalities/hooks";
7
+ import { useAppSelector } from "../../../app/hooks";
8
+ import {
9
+ AttachedFileData,
10
+ selectAttachedFilesOptions,
11
+ } from "../../functionalities/functionalitiesSlice";
12
+ import { Button } from "primereact/button";
13
+
14
+ import styles from "./AttachedFilesSidebarContent.module.scss";
15
+ import { copyToClipboard } from "../../../utils/clipboard";
16
+ import { downloadFile } from "../../../utils/download";
17
+ import { useFileUpload } from "use-file-upload";
18
+ import mime from "mime";
19
+ import { useToast } from "../../toast";
20
+
21
+ const AttachedFilesSidebarContent: FC = () => {
22
+ const filesData = useAttachedFiles();
23
+ const attachedFilesOptions = useAppSelector(selectAttachedFilesOptions);
24
+ const [_, selectFile] = useFileUpload();
25
+
26
+ return (
27
+ <div className={styles.sidebarContent}>
28
+ <div className={styles.attachedFiles}>
29
+ {filesData.map((file) => (
30
+ <AttachedFileLinks key={file.name} fileData={file} />
31
+ ))}
32
+ </div>
33
+ {attachedFilesOptions.uploadTemporaryFiles && (
34
+ <div className={styles.uploadFilesButtonContainer}>
35
+ <Button
36
+ aria-label="Ajouter fichier temporaire"
37
+ icon="pi pi-upload"
38
+ label={
39
+ attachedFilesOptions.uploadTemporaryFiles?.uploadButtonLabel ||
40
+ "Ajouter fichier temporaire"
41
+ }
42
+ onClick={() => {
43
+ selectFile(
44
+ {
45
+ multiple: attachedFilesOptions.uploadTemporaryFiles?.multiple,
46
+ accept:
47
+ attachedFilesOptions.uploadTemporaryFiles?.mimeTypes?.join(
48
+ ",",
49
+ ) || undefined,
50
+ },
51
+ (filesOrFiles) => {
52
+ if (Array.isArray(filesOrFiles)) {
53
+ attachedFilesOptions.uploadTemporaryFiles?.handler(
54
+ filesOrFiles,
55
+ );
56
+ } else {
57
+ /* Deconstructing the object here so that if there is a
58
+ bug, the error will be caught here and not in the handler */
59
+ const { source, name, size, file } = filesOrFiles;
60
+ attachedFilesOptions.uploadTemporaryFiles?.handler([
61
+ { source, name, size, file },
62
+ ]);
63
+ }
64
+ },
65
+ );
66
+ }}
67
+ className={styles.uploadButton}
68
+ />
69
+ </div>
70
+ )}
71
+ </div>
72
+ );
73
+ };
74
+
75
+ const AttachedFileLinks: FC<{ fileData: AttachedFileData }> = ({
76
+ fileData,
77
+ }) => {
78
+ const attachedFilesOptions = useAppSelector(selectAttachedFilesOptions);
79
+ const toast = useToast();
80
+ const previewTextFile = usePreviewTextFile();
81
+ const previewImageFile = usePreviewImageFile();
82
+
83
+ return (
84
+ <div className={styles.fileRow}>
85
+ <Button
86
+ label={fileData.name}
87
+ severity={fileData.isTemporary ? "warning" : "secondary"}
88
+ disabled={fileData.interactMode === "none"}
89
+ onClick={async () => {
90
+ if (fileData.interactMode === "custom") {
91
+ attachedFilesOptions.customHandlers?.interactWithFile?.(fileData);
92
+ } else if (fileData.interactMode === "download") {
93
+ window.open(fileData.urlOrId, "_blank")?.focus();
94
+ } else if (fileData.interactMode === "preview") {
95
+ const mimeType = mime.getType(fileData.name);
96
+ if (
97
+ mimeType?.startsWith("text") ||
98
+ mimeType === "application/json"
99
+ ) {
100
+ // fetch file content
101
+ const response = await fetch(fileData.urlOrId);
102
+ const content = await response.text();
103
+ previewTextFile(fileData.name, content);
104
+ } else if (mimeType?.startsWith("image")) {
105
+ previewImageFile(fileData.name, fileData.urlOrId);
106
+ } else {
107
+ toast.show({
108
+ severity: "info",
109
+ summary: `Impossible de prévisualiser {fileData.name}`,
110
+ detail: `Aperçu non disponible pour ce type de fichier (${mimeType})`,
111
+ life: 3000,
112
+ });
113
+ }
114
+ }
115
+ }}
116
+ className={styles.fileInteraction}
117
+ text
118
+ />
119
+ {fileData.downloadMode !== "none" && (
120
+ <Button
121
+ icon="pi pi-download"
122
+ severity="secondary"
123
+ onClick={() => {
124
+ if (fileData.downloadMode === "custom") {
125
+ attachedFilesOptions.customHandlers?.downloadFile?.(fileData);
126
+ return;
127
+ } else if (fileData.downloadMode === "default") {
128
+ downloadFile(fileData.urlOrId, fileData.name);
129
+ toast.show({
130
+ severity: "success",
131
+ summary: "Téléchargement lancé",
132
+ detail: fileData.name,
133
+ life: 3000,
134
+ });
135
+ }
136
+ }}
137
+ className={styles.fileSmallInteraction}
138
+ text
139
+ />
140
+ )}
141
+ {fileData.copyLinkMode !== "none" && (
142
+ <Button
143
+ icon="pi pi-link"
144
+ severity="secondary"
145
+ onClick={() => {
146
+ if (fileData.copyLinkMode === "custom") {
147
+ attachedFilesOptions.customHandlers?.copyFileLink?.(fileData);
148
+ return;
149
+ } else if (fileData.copyLinkMode === "default") {
150
+ // copy link to clipboard
151
+ copyToClipboard(fileData.urlOrId, (success, error) => {
152
+ if (success) {
153
+ toast.show({
154
+ severity: "success",
155
+ summary: "Lien copié",
156
+ detail: fileData.name,
157
+ life: 3000,
158
+ });
159
+ } else {
160
+ toast.show({
161
+ severity: "error",
162
+ summary: "Erreur lors de la copie du lien",
163
+ detail: error,
164
+ life: 5000,
165
+ });
166
+ }
167
+ });
168
+ }
169
+ }}
170
+ style={{
171
+ flexGrow: 0,
172
+ flexShrink: 0,
173
+ }}
174
+ text
175
+ />
176
+ )}
177
+ </div>
178
+ );
179
+ };
180
+
181
+ export default AttachedFilesSidebarContent;