@collabdt/core 0.0.50 → 0.0.51

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.
@@ -5,4 +5,5 @@ export * from './viewers';
5
5
  export * from './ui';
6
6
  export * from './Toolbar';
7
7
  export { InstanceNotFound } from './instance-not-found';
8
+ export * from './organizationConfig';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,MAAM,CAAA;AACpB,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,MAAM,CAAA;AACpB,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,cAAc,sBAAsB,CAAA"}
@@ -5,6 +5,7 @@ export * from "./viewers";
5
5
  export * from "./ui";
6
6
  export * from "./Toolbar";
7
7
  import { InstanceNotFound } from "./instance-not-found";
8
+ export * from "./organizationConfig";
8
9
  export {
9
10
  InstanceNotFound
10
11
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/components/index.ts"],"sourcesContent":["export * from './AppSidebarContent'\r\nexport * from './authentication'\r\nexport * from './settings'\r\nexport * from './viewers'\r\nexport * from './ui'\r\nexport * from './Toolbar'\r\nexport { InstanceNotFound } from './instance-not-found'"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,wBAAwB;","names":[]}
1
+ {"version":3,"sources":["../../../src/core/components/index.ts"],"sourcesContent":["export * from './AppSidebarContent'\r\nexport * from './authentication'\r\nexport * from './settings'\r\nexport * from './viewers'\r\nexport * from './ui'\r\nexport * from './Toolbar'\r\nexport { InstanceNotFound } from './instance-not-found'\r\nexport * from './organizationConfig'"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,wBAAwB;AACjC,cAAc;","names":[]}
@@ -0,0 +1,2 @@
1
+ export default function OrganizationConfigPage(): import("react").JSX.Element;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/components/organizationConfig/index.tsx"],"names":[],"mappings":"AAcA,MAAM,CAAC,OAAO,UAAU,sBAAsB,gCAiE7C"}
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useState } from "react";
4
+ import { useScroll, useSpring, useTransform } from "framer-motion";
5
+ import { Toaster } from "sonner";
6
+ import { useLocale } from "next-intl";
7
+ import { useRouter } from "next/navigation";
8
+ import Navbar from "../ui/Navbar";
9
+ import AnimatedBackground from "../ui/AnimatedBackground";
10
+ import OrganizationConfigContent from "./src/organizationConfigContent";
11
+ function OrganizationConfigPage() {
12
+ const [theme, setTheme] = useState("dark");
13
+ const locale = useLocale();
14
+ const router = useRouter();
15
+ const { scrollY } = useScroll();
16
+ const navOpacity = useTransform(scrollY, [0, 100], [0.8, 1]);
17
+ const navY = useSpring(
18
+ useTransform(scrollY, [0, 100], [0, 0]),
19
+ {
20
+ stiffness: 300,
21
+ damping: 30
22
+ }
23
+ );
24
+ useEffect(() => {
25
+ const isDark = window.matchMedia(
26
+ "(prefers-color-scheme: dark)"
27
+ ).matches;
28
+ setTheme(isDark ? "dark" : "light");
29
+ document.documentElement.classList.toggle("dark", isDark);
30
+ }, []);
31
+ const toggleTheme = () => {
32
+ const newTheme = theme === "dark" ? "light" : "dark";
33
+ setTheme(newTheme);
34
+ document.documentElement.classList.toggle("dark", newTheme === "dark");
35
+ };
36
+ const toggleLanguage = () => {
37
+ const expires = /* @__PURE__ */ new Date();
38
+ expires.setFullYear(expires.getFullYear() + 1);
39
+ document.cookie = `NEXT_LOCALE=${locale}; expires=${expires.toUTCString()}; path=/; SameSite=Lax`;
40
+ router.refresh();
41
+ };
42
+ return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-background text-foreground relative overflow-hidden", children: [
43
+ /* @__PURE__ */ jsx(AnimatedBackground, {}),
44
+ /* @__PURE__ */ jsx(Toaster, { richColors: true }),
45
+ /* @__PURE__ */ jsx(
46
+ Navbar,
47
+ {
48
+ activeSection: "",
49
+ theme,
50
+ locale,
51
+ navOpacity,
52
+ navY,
53
+ onToggleTheme: toggleTheme,
54
+ onToggleLanguage: toggleLanguage,
55
+ onScrollToSection: () => {
56
+ },
57
+ showNavigation: false
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsx(OrganizationConfigContent, {})
61
+ ] });
62
+ }
63
+ export {
64
+ OrganizationConfigPage as default
65
+ };
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/core/components/organizationConfig/index.tsx"],"sourcesContent":["'use client'\r\n\r\nimport { useEffect, useState } from 'react'\r\nimport { useScroll, useSpring, useTransform } from 'framer-motion'\r\nimport { Toaster } from 'sonner'\r\nimport { useLocale } from 'next-intl'\r\nimport { useRouter } from 'next/navigation'\r\n\r\nimport Navbar from '../ui/Navbar'\r\nimport AnimatedBackground from '../ui/AnimatedBackground'\r\nimport OrganizationConfigContent from './src/organizationConfigContent'\r\n\r\nimport { Language } from '../../types/dbTypes'\r\n\r\nexport default function OrganizationConfigPage() {\r\n const [theme, setTheme] = useState<'light' | 'dark'>('dark')\r\n\r\n const locale = useLocale() as Language\r\n const router = useRouter()\r\n\r\n const { scrollY } = useScroll()\r\n\r\n const navOpacity = useTransform(scrollY, [0, 100], [0.8, 1])\r\n\r\n const navY = useSpring(\r\n useTransform(scrollY, [0, 100], [0, 0]),\r\n {\r\n stiffness: 300,\r\n damping: 30,\r\n }\r\n )\r\n\r\n useEffect(() => {\r\n const isDark = window.matchMedia(\r\n '(prefers-color-scheme: dark)'\r\n ).matches\r\n\r\n setTheme(isDark ? 'dark' : 'light')\r\n\r\n document.documentElement.classList.toggle('dark', isDark)\r\n }, [])\r\n\r\n const toggleTheme = () => {\r\n const newTheme = theme === 'dark' ? 'light' : 'dark'\r\n\r\n setTheme(newTheme)\r\n document.documentElement.classList.toggle('dark', newTheme === 'dark')\r\n }\r\n\r\n const toggleLanguage = () => {\r\n const expires = new Date()\r\n expires.setFullYear(expires.getFullYear() + 1)\r\n\r\n document.cookie = `NEXT_LOCALE=${locale}; expires=${expires.toUTCString()}; path=/; SameSite=Lax`\r\n\r\n router.refresh()\r\n }\r\n\r\n return (\r\n <div className=\"min-h-screen bg-background text-foreground relative overflow-hidden\">\r\n <AnimatedBackground />\r\n\r\n <Toaster richColors />\r\n\r\n <Navbar\r\n activeSection=\"\"\r\n theme={theme}\r\n locale={locale}\r\n navOpacity={navOpacity}\r\n navY={navY}\r\n onToggleTheme={toggleTheme}\r\n onToggleLanguage={toggleLanguage}\r\n onScrollToSection={() => {}}\r\n showNavigation={false}\r\n />\r\n\r\n <OrganizationConfigContent />\r\n </div>\r\n )\r\n}"],"mappings":";AA2DI,SACE,KADF;AAzDJ,SAAS,WAAW,gBAAgB;AACpC,SAAS,WAAW,WAAW,oBAAoB;AACnD,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAE1B,OAAO,YAAY;AACnB,OAAO,wBAAwB;AAC/B,OAAO,+BAAgC;AAIxB,SAAR,yBAA0C;AAC/C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA2B,MAA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izationConfigContent(): import("react").JSX.Element;
2
+ //# sourceMappingURL=organizationConfigContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizationConfigContent.d.ts","sourceRoot":"","sources":["../../../../../src/core/components/organizationConfig/src/organizationConfigContent.tsx"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,yBAAyB,gCAmRhD"}
@@ -0,0 +1,229 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { motion } from "framer-motion";
4
+ import { useState } from "react";
5
+ import { useRouter } from "next/navigation";
6
+ import { useTranslations } from "next-intl";
7
+ import { Button } from "../../ui/Button";
8
+ import { Card } from "../../ui/Card";
9
+ import { Input } from "../../ui/Input";
10
+ import { Textarea } from "../../ui/Textarea";
11
+ import Footer from "../../ui/Footer";
12
+ function OrganizationConfigContent() {
13
+ const t = useTranslations("OrganizationConfig");
14
+ const router = useRouter();
15
+ const [error, setError] = useState(null);
16
+ const [loading, setLoading] = useState(false);
17
+ function validateOrgName(name) {
18
+ const regex = /^[a-z0-9.-]{3,63}$/;
19
+ return regex.test(name);
20
+ }
21
+ async function handleSubmit(e) {
22
+ var _a;
23
+ e.preventDefault();
24
+ setError(null);
25
+ setLoading(true);
26
+ const formData = new FormData(e.currentTarget);
27
+ const orgLanguages = formData.getAll("orgLanguages").map(String);
28
+ const data = {
29
+ orgName: formData.get("orgName"),
30
+ orgTitle: formData.get("orgTitle"),
31
+ orgDescription: formData.get("orgDescription"),
32
+ orgLanguages,
33
+ adminName: formData.get("adminName"),
34
+ adminEmail: formData.get("adminEmail"),
35
+ adminPassword: formData.get("adminPassword")
36
+ };
37
+ try {
38
+ const res = await fetch("/api/setup", {
39
+ method: "POST",
40
+ headers: {
41
+ "Content-Type": "application/json"
42
+ },
43
+ body: JSON.stringify(data)
44
+ });
45
+ const json = await res.json();
46
+ if (res.ok && json.success) {
47
+ router.push(`/${data.orgName}/auth/signin`);
48
+ return;
49
+ }
50
+ setError((_a = json.error) != null ? _a : "Failed to initialize instance.");
51
+ } catch (e2) {
52
+ setError("Network error. Please try again.");
53
+ } finally {
54
+ setLoading(false);
55
+ }
56
+ }
57
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
58
+ /* @__PURE__ */ jsx("section", { className: "min-h-screen py-32 relative flex items-center z-10", children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-6", children: /* @__PURE__ */ jsxs(
59
+ motion.div,
60
+ {
61
+ initial: { opacity: 0, y: 30 },
62
+ animate: { opacity: 1, y: 0 },
63
+ className: "max-w-5xl mx-auto",
64
+ children: [
65
+ /* @__PURE__ */ jsxs("div", { className: "text-center mb-16 space-y-6", children: [
66
+ /* @__PURE__ */ jsx("h1", { className: "text-4xl md:text-5xl font-bold", children: t("title") }),
67
+ /* @__PURE__ */ jsx("p", { className: "text-lg text-muted-foreground max-w-3xl mx-auto", children: t("description") })
68
+ ] }),
69
+ /* @__PURE__ */ jsxs("div", { className: "grid lg:grid-cols-3 gap-8", children: [
70
+ /* @__PURE__ */ jsxs(Card, { className: "lg:col-span-2 p-8", children: [
71
+ /* @__PURE__ */ jsx("h3", { className: "text-2xl font-bold mb-6", children: t("setupTitle") }),
72
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-8", children: t("setupDescription") }),
73
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [
74
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
75
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Organization Name / Slug" }),
76
+ /* @__PURE__ */ jsx(
77
+ Input,
78
+ {
79
+ name: "orgName",
80
+ placeholder: "my-org",
81
+ required: true,
82
+ minLength: 3,
83
+ maxLength: 63,
84
+ pattern: "^[a-z0-9.-]+$"
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "3\u201363 characters. Lowercase letters, numbers, dots, and hyphens only." })
88
+ ] }),
89
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
90
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Organization Title" }),
91
+ /* @__PURE__ */ jsx(
92
+ Input,
93
+ {
94
+ name: "orgTitle",
95
+ placeholder: "Organization Title",
96
+ required: true
97
+ }
98
+ )
99
+ ] }),
100
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
101
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Organization Description" }),
102
+ /* @__PURE__ */ jsx(
103
+ Textarea,
104
+ {
105
+ name: "orgDescription",
106
+ placeholder: "Organization Description",
107
+ rows: 4,
108
+ required: true
109
+ }
110
+ )
111
+ ] }),
112
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
113
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Languages" }),
114
+ /* @__PURE__ */ jsxs(
115
+ "select",
116
+ {
117
+ name: "orgLanguages",
118
+ multiple: true,
119
+ defaultValue: ["En"],
120
+ className: "w-full rounded-md border border-input bg-background px-3 py-2 min-h-[100px]",
121
+ children: [
122
+ /* @__PURE__ */ jsx("option", { value: "En", children: "English" }),
123
+ /* @__PURE__ */ jsx("option", { value: "Fr", children: "French" }),
124
+ /* @__PURE__ */ jsx("option", { value: "Es", children: "Spanish" })
125
+ ]
126
+ }
127
+ ),
128
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Hold Ctrl (Windows) / Cmd (Mac) to select multiple languages" })
129
+ ] }),
130
+ /* @__PURE__ */ jsxs("div", { className: "border-t pt-6", children: [
131
+ /* @__PURE__ */ jsx("h4", { className: "font-semibold mb-4", children: "Administrator Account" }),
132
+ /* @__PURE__ */ jsxs("div", { className: "grid sm:grid-cols-2 gap-4", children: [
133
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
134
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Admin Name" }),
135
+ /* @__PURE__ */ jsx(
136
+ Input,
137
+ {
138
+ name: "adminName",
139
+ placeholder: "Admin Name",
140
+ required: true
141
+ }
142
+ )
143
+ ] }),
144
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
145
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Admin Email" }),
146
+ /* @__PURE__ */ jsx(
147
+ Input,
148
+ {
149
+ name: "adminEmail",
150
+ type: "email",
151
+ placeholder: "admin@example.com",
152
+ required: true
153
+ }
154
+ )
155
+ ] })
156
+ ] }),
157
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 flex flex-col gap-2", children: [
158
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Password" }),
159
+ /* @__PURE__ */ jsx(
160
+ Input,
161
+ {
162
+ name: "adminPassword",
163
+ type: "password",
164
+ placeholder: "Password",
165
+ minLength: 8,
166
+ required: true
167
+ }
168
+ )
169
+ ] })
170
+ ] }),
171
+ error && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-500/20 bg-red-500/10 p-4 text-sm text-red-500", children: error }),
172
+ /* @__PURE__ */ jsx(
173
+ Button,
174
+ {
175
+ type: "submit",
176
+ size: "lg",
177
+ className: "gradient-button w-full",
178
+ disabled: loading,
179
+ children: loading ? "Initializing Instance..." : "Initialize Instance"
180
+ }
181
+ )
182
+ ] })
183
+ ] }),
184
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
185
+ /* @__PURE__ */ jsxs(Card, { className: "p-6 hover-card", children: [
186
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold mb-3", children: t("contactInfoTitle") }),
187
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
188
+ /* @__PURE__ */ jsxs("div", { children: [
189
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-1", children: t("emailLabel") }),
190
+ /* @__PURE__ */ jsx(
191
+ "a",
192
+ {
193
+ href: "mailto:info@collabdt.org",
194
+ className: "text-primary hover:underline font-medium text-sm",
195
+ children: "info@collabdt.org"
196
+ }
197
+ )
198
+ ] }),
199
+ /* @__PURE__ */ jsxs("div", { children: [
200
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-1", children: t("websiteLabel") }),
201
+ /* @__PURE__ */ jsx(
202
+ "a",
203
+ {
204
+ href: "https://collabdt.org",
205
+ target: "_blank",
206
+ rel: "noopener noreferrer",
207
+ className: "text-primary hover:underline font-medium text-sm",
208
+ children: "collabdt.org"
209
+ }
210
+ )
211
+ ] })
212
+ ] })
213
+ ] }),
214
+ /* @__PURE__ */ jsxs(Card, { className: "p-6 hover-card bg-primary/5 border-primary/20", children: [
215
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold mb-3", children: t("needHelpTitle") }),
216
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("needHelpDescription") })
217
+ ] })
218
+ ] })
219
+ ] })
220
+ ]
221
+ }
222
+ ) }) }),
223
+ /* @__PURE__ */ jsx(Footer, {})
224
+ ] });
225
+ }
226
+ export {
227
+ OrganizationConfigContent as default
228
+ };
229
+ //# sourceMappingURL=organizationConfigContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/core/components/organizationConfig/src/organizationConfigContent.tsx"],"sourcesContent":["'use client'\r\n\r\nimport { motion } from 'framer-motion'\r\nimport { useState } from 'react'\r\nimport { useRouter } from 'next/navigation'\r\nimport { useTranslations } from 'next-intl'\r\n\r\nimport { Button } from '../../ui/Button'\r\nimport { Card } from '../../ui/Card'\r\nimport { Input } from '../../ui/Input'\r\nimport { Textarea } from '../../ui/Textarea'\r\nimport Footer from '../../ui/Footer'\r\n\r\nexport default function OrganizationConfigContent() {\r\n const t = useTranslations('OrganizationConfig')\r\n const router = useRouter()\r\n\r\n const [error, setError] = useState<string | null>(null)\r\n const [loading, setLoading] = useState(false)\r\n\r\n function validateOrgName(name: string) {\r\n const regex = /^[a-z0-9.-]{3,63}$/\r\n return regex.test(name)\r\n }\r\n\r\n async function handleSubmit(\r\n e: React.FormEvent<HTMLFormElement>\r\n ) {\r\n e.preventDefault()\r\n\r\n setError(null)\r\n setLoading(true)\r\n \r\n \r\n const formData = new FormData(e.currentTarget)\r\n \r\n const orgLanguages = formData\r\n .getAll('orgLanguages')\r\n .map(String)\r\n\r\n const data = {\r\n orgName: formData.get('orgName'),\r\n orgTitle: formData.get('orgTitle'),\r\n orgDescription: formData.get('orgDescription'),\r\n orgLanguages,\r\n adminName: formData.get('adminName'),\r\n adminEmail: formData.get('adminEmail'),\r\n adminPassword: formData.get('adminPassword'),\r\n }\r\n\r\n try {\r\n const res = await fetch('/api/setup', {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify(data),\r\n })\r\n\r\n const json = await res.json()\r\n\r\n if (res.ok && json.success) {\r\n router.push(`/${data.orgName}/auth/signin`)\r\n return\r\n }\r\n\r\n setError(json.error ?? 'Failed to initialize instance.')\r\n } catch {\r\n setError('Network error. Please try again.')\r\n } finally {\r\n setLoading(false)\r\n }\r\n }\r\n\r\n return (\r\n <>\r\n <section className=\"min-h-screen py-32 relative flex items-center z-10\">\r\n <div className=\"container mx-auto px-6\">\r\n <motion.div\r\n initial={{ opacity: 0, y: 30 }}\r\n animate={{ opacity: 1, y: 0 }}\r\n className=\"max-w-5xl mx-auto\"\r\n >\r\n <div className=\"text-center mb-16 space-y-6\">\r\n <h1 className=\"text-4xl md:text-5xl font-bold\">\r\n {t('title')}\r\n </h1>\r\n\r\n <p className=\"text-lg text-muted-foreground max-w-3xl mx-auto\">\r\n {t('description')}\r\n </p>\r\n </div>\r\n\r\n <div className=\"grid lg:grid-cols-3 gap-8\">\r\n <Card className=\"lg:col-span-2 p-8\">\r\n <h3 className=\"text-2xl font-bold mb-6\">\r\n {t('setupTitle')}\r\n </h3>\r\n\r\n <p className=\"text-muted-foreground mb-8\">\r\n {t('setupDescription')}\r\n </p>\r\n\r\n <form onSubmit={handleSubmit} className=\"space-y-6\">\r\n\r\n {/* Org Name */}\r\n <div className=\"flex flex-col gap-2\">\r\n <label className=\"text-sm font-medium\">\r\n Organization Name / Slug\r\n </label>\r\n <Input\r\n name=\"orgName\"\r\n placeholder=\"my-org\"\r\n required\r\n minLength={3}\r\n maxLength={63}\r\n pattern=\"^[a-z0-9.-]+$\"\r\n />\r\n <p className=\"text-xs text-muted-foreground\">\r\n 3–63 characters. Lowercase letters, numbers, dots, and hyphens only.\r\n </p>\r\n </div>\r\n\r\n {/* Org Title */}\r\n <div className=\"flex flex-col gap-2\">\r\n <label className=\"text-sm font-medium\">\r\n Organization Title\r\n </label>\r\n <Input\r\n name=\"orgTitle\"\r\n placeholder=\"Organization Title\"\r\n required\r\n />\r\n </div>\r\n\r\n {/* Org Description */}\r\n <div className=\"flex flex-col gap-2\">\r\n <label className=\"text-sm font-medium\">\r\n Organization Description\r\n </label>\r\n <Textarea\r\n name=\"orgDescription\"\r\n placeholder=\"Organization Description\"\r\n rows={4}\r\n required\r\n />\r\n </div>\r\n\r\n {/* Languages */}\r\n <div className=\"flex flex-col gap-2\">\r\n <label className=\"text-sm font-medium\">\r\n Languages\r\n </label>\r\n\r\n <select\r\n name=\"orgLanguages\"\r\n multiple\r\n defaultValue={['En']}\r\n className=\"w-full rounded-md border border-input bg-background px-3 py-2 min-h-[100px]\"\r\n >\r\n <option value=\"En\">English</option>\r\n <option value=\"Fr\">French</option>\r\n <option value=\"Es\">Spanish</option>\r\n </select>\r\n\r\n <p className=\"text-xs text-muted-foreground\">\r\n Hold Ctrl (Windows) / Cmd (Mac) to select multiple languages\r\n </p>\r\n </div>\r\n\r\n {/* Admin Section */}\r\n <div className=\"border-t pt-6\">\r\n <h4 className=\"font-semibold mb-4\">\r\n Administrator Account\r\n </h4>\r\n\r\n <div className=\"grid sm:grid-cols-2 gap-4\">\r\n <div className=\"flex flex-col gap-2\">\r\n <label className=\"text-sm font-medium\">\r\n Admin Name\r\n </label>\r\n <Input\r\n name=\"adminName\"\r\n placeholder=\"Admin Name\"\r\n required\r\n />\r\n </div>\r\n\r\n <div className=\"flex flex-col gap-2\">\r\n <label className=\"text-sm font-medium\">\r\n Admin Email\r\n </label>\r\n <Input\r\n name=\"adminEmail\"\r\n type=\"email\"\r\n placeholder=\"admin@example.com\"\r\n required\r\n />\r\n </div>\r\n </div>\r\n\r\n <div className=\"mt-4 flex flex-col gap-2\">\r\n <label className=\"text-sm font-medium\">\r\n Password\r\n </label>\r\n <Input\r\n name=\"adminPassword\"\r\n type=\"password\"\r\n placeholder=\"Password\"\r\n minLength={8}\r\n required\r\n />\r\n </div>\r\n </div>\r\n\r\n {/* Error */}\r\n {error && (\r\n <div className=\"rounded-md border border-red-500/20 bg-red-500/10 p-4 text-sm text-red-500\">\r\n {error}\r\n </div>\r\n )}\r\n\r\n <Button\r\n type=\"submit\"\r\n size=\"lg\"\r\n className=\"gradient-button w-full\"\r\n disabled={loading}\r\n >\r\n {loading ? 'Initializing Instance...' : 'Initialize Instance'}\r\n </Button>\r\n </form>\r\n </Card>\r\n\r\n <div className=\"space-y-6\">\r\n <Card className=\"p-6 hover-card\">\r\n <h3 className=\"text-lg font-bold mb-3\">\r\n {t('contactInfoTitle')}\r\n </h3>\r\n\r\n <div className=\"space-y-4\">\r\n <div>\r\n <p className=\"text-sm text-muted-foreground mb-1\">\r\n {t('emailLabel')}\r\n </p>\r\n\r\n <a\r\n href=\"mailto:info@collabdt.org\"\r\n className=\"text-primary hover:underline font-medium text-sm\"\r\n >\r\n info@collabdt.org\r\n </a>\r\n </div>\r\n\r\n <div>\r\n <p className=\"text-sm text-muted-foreground mb-1\">\r\n {t('websiteLabel')}\r\n </p>\r\n\r\n <a\r\n href=\"https://collabdt.org\"\r\n target=\"_blank\"\r\n rel=\"noopener noreferrer\"\r\n className=\"text-primary hover:underline font-medium text-sm\"\r\n >\r\n collabdt.org\r\n </a>\r\n </div>\r\n </div>\r\n </Card>\r\n\r\n <Card className=\"p-6 hover-card bg-primary/5 border-primary/20\">\r\n <h3 className=\"text-lg font-bold mb-3\">\r\n {t('needHelpTitle')}\r\n </h3>\r\n\r\n <p className=\"text-sm text-muted-foreground\">\r\n {t('needHelpDescription')}\r\n </p>\r\n </Card>\r\n </div>\r\n </div>\r\n </motion.div>\r\n </div>\r\n </section>\r\n\r\n <Footer />\r\n </>\r\n )\r\n}"],"mappings":";AA2EI,mBASU,KADF,YARR;AAzEJ,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAEhC,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,OAAO,YAAY;AAEJ,SAAR,4BAA6C;AAClD,QAAM,IAAI,gBAAgB,oBAAoB;AAC9C,QAAM,SAAS,UAAU;AAEzB,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAE5C,WAAS,gBAAgB,MAAc;AACvC,UAAM,QAAQ;AACd,WAAO,MAAM,KAAK,IAAI;AAAA,EACtB;AAEA,iBAAe,aACb,GACA;AA3BJ;AA4BI,MAAE,eAAe;AAEjB,aAAS,IAAI;AACb,eAAW,IAAI;AAGf,UAAM,WAAW,IAAI,SAAS,EAAE,aAAa;AAE7C,UAAM,eAAe,SAClB,OAAO,cAAc,EACrB,IAAI,MAAM;AAEb,UAAM,OAAO;AAAA,MACX,SAAS,SAAS,IAAI,SAAS;AAAA,MAC/B,UAAU,SAAS,IAAI,UAAU;AAAA,MACjC,gBAAgB,SAAS,IAAI,gBAAgB;AAAA,MAC7C;AAAA,MACA,WAAW,SAAS,IAAI,WAAW;AAAA,MACnC,YAAY,SAAS,IAAI,YAAY;AAAA,MACrC,eAAe,SAAS,IAAI,eAAe;AAAA,IAC7C;AAEA,QAAI;AACF,YAAM,MAAM,MAAM,MAAM,cAAc;AAAA,QACpC,QAAQ;AAAA,QACR,S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;AAAA,iBACF;AAAA,cAEA,qBAAC,QAAK,WAAU,iDACd;AAAA,oCAAC,QAAG,WAAU,0BACX,YAAE,eAAe,GACpB;AAAA,gBAEA,oBAAC,OAAE,WAAU,iCACV,YAAE,qBAAqB,GAC1B;AAAA,iBACF;AAAA,eACF;AAAA,aACA;AAAA;AAAA;AAAA,IACF,GACF,GACF;AAAA,IAEA,oBAAC,UAAO;AAAA,KACV;AAEJ;","names":["e"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AppSidebar.d.ts","sourceRoot":"","sources":["../../../../src/core/components/ui/AppSidebar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,WAAW,EACnB,iBAAiB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAC1D,iBAAiB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAC1D,iBAAiB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAC1D,SAAS,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,EACjE,eAAe,GAAG,SAYnB,CAAA;AAED,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAClF;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,eAAe,qBAqEhE"}
1
+ {"version":3,"file":"AppSidebar.d.ts","sourceRoot":"","sources":["../../../../src/core/components/ui/AppSidebar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,WAAW,EACnB,iBAAiB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAC1D,iBAAiB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAC1D,iBAAiB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAC1D,SAAS,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,EACjE,eAAe,GAAG,SAYnB,CAAA;AAED,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAClF;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,eAAe,qBA4FhE"}
@@ -47,21 +47,36 @@ function AppSidebar({ children, signOut }) {
47
47
  }
48
48
  ) }),
49
49
  children,
50
- /* @__PURE__ */ jsxs("div", { className: `w-full flex flex-col ${sidebarState === "expanded" ? "items-center justify-center" : "justify-center"}`, children: [
51
- /* @__PURE__ */ jsx(NavUser, { signOut }),
52
- /* @__PURE__ */ jsx(Link, { href: "https://collabdt.org/", className: sidebarState === "expanded" ? "w-full" : "", target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsxs(
53
- Button,
54
- {
55
- title: isCollapsed ? t("home") : void 0,
56
- variant: "ghost",
57
- className: `text-xs scale-[85%] py-0 my-0 w-full ${sidebarState === "expanded" ? "flex flex-row items-center justify-center gap-2" : "flex flex-col items-center"}`,
58
- children: [
59
- !isCollapsed && /* @__PURE__ */ jsx(CdtIcon, { monochromatic: true }),
60
- /* @__PURE__ */ jsx("span", { className: isCollapsed ? "hidden" : "inline", children: t("home") })
61
- ]
62
- }
63
- ) })
64
- ] })
50
+ /* @__PURE__ */ jsxs(
51
+ "div",
52
+ {
53
+ className: `w-full flex flex-col ${sidebarState === "expanded" ? "items-center justify-center" : "justify-center"}`,
54
+ children: [
55
+ /* @__PURE__ */ jsx(NavUser, { signOut }),
56
+ /* @__PURE__ */ jsx(
57
+ Link,
58
+ {
59
+ href: "https://collabdt.org/",
60
+ className: sidebarState === "expanded" ? "w-full" : "",
61
+ target: "_blank",
62
+ rel: "noopener noreferrer",
63
+ children: /* @__PURE__ */ jsx(
64
+ Button,
65
+ {
66
+ title: isCollapsed ? t("home") : void 0,
67
+ variant: "ghost",
68
+ className: `text-xs scale-[85%] py-0 my-0 w-full ${sidebarState === "expanded" ? "flex flex-row items-center justify-center gap-2" : "flex flex-col items-center"}`,
69
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
70
+ /* @__PURE__ */ jsx("div", { className: isCollapsed ? "scale-75" : "", children: /* @__PURE__ */ jsx(CdtIcon, { monochromatic: true }) }),
71
+ !isCollapsed && /* @__PURE__ */ jsx("span", { children: t("home") })
72
+ ] })
73
+ }
74
+ )
75
+ }
76
+ )
77
+ ]
78
+ }
79
+ )
65
80
  ] })
66
81
  ] });
67
82
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/components/ui/AppSidebar.tsx"],"sourcesContent":["'use client'\r\nimport * as React from 'react'\r\n\r\n// Dependencies\r\nimport { Button } from './Button'\r\n\r\n// Icons\r\nimport * as LR from 'lucide-react'\r\n\r\nimport { useTranslations } from 'next-intl'\r\nimport { CdtIcon } from './Icons/CdtIcon'\r\nimport Link from 'next/link'\r\nimport { Sidebar, useSidebar, NavUser } from './'\r\nimport { ViewerNames } from '../../types'\r\nimport { useMenusContext } from '../../store'\r\n\r\nexport const handleChangeViewer = (\r\n viewer: ViewerNames,\r\n setSelectedItem: React.Dispatch<React.SetStateAction<any>>,\r\n setSelectedSite: React.Dispatch<React.SetStateAction<any>>,\r\n setSelectedFile: React.Dispatch<React.SetStateAction<any>>,\r\n setView: React.Dispatch<React.SetStateAction<'table' | 'detail'>>,\r\n menusDispatch: any,\r\n) => {\r\n // Reset selected item, file, & view when changing viewer\r\n setSelectedItem(null)\r\n setSelectedSite(null)\r\n setSelectedFile(null)\r\n setView('table')\r\n\r\n menusDispatch({\r\n type: 'SET_VIEWER',\r\n payload: { currentViewer: viewer },\r\n })\r\n}\r\n\r\ninterface AppSidebarProps {\r\n children?: React.ReactNode\r\n signOut: (options?: { redirectTo?: string; redirect?: boolean }) => Promise<void>\r\n}\r\n\r\nexport function AppSidebar({ children, signOut }: AppSidebarProps) {\r\n // Translations\r\n const t = useTranslations('AppSidebar')\r\n\r\n const { state: menusState } = useMenusContext()\r\n\r\n const { sidebarState, isMobile, openMobile, toggleMenuSidebar } = useSidebar()\r\n\r\n const { currentViewer } = menusState.menus\r\n\r\n // On mobile, treat the sheet open as expanded so labels render when the drawer is visible\r\n const isCollapsed = isMobile ? !openMobile : sidebarState === 'collapsed'\r\n\r\n // Determine the collapsible type based on the current viewer\r\n const collapsibleType = currentViewer === ViewerNames.auth ? 'offcanvas' : 'icon'\r\n\r\n return (\r\n <>\r\n {/* Always show toggle button on mobile when collapsed */}\r\n {isMobile && isCollapsed && (\r\n <div id='sidebar-toggle-button-mobile' className='fixed left-0 top-1/2 -translate-y-1/2 z-[100] flex items-center justify-center pointer-events-auto'>\r\n <button\r\n onClick={toggleMenuSidebar}\r\n className=\"text-muted-foreground hover:text-primary p-[2px] rounded-r-md bg-sidebar\"\r\n style={{ border: '1px solid rgba(128,128,128,0.2)', borderLeft: 'none', boxShadow: '4px 0 8px -4px rgba(0,0,0,0.12)' }}\r\n >\r\n <LR.ChevronRight className=\"w-5\" />\r\n </button>\r\n </div>\r\n )}\r\n <Sidebar collapsible={collapsibleType} className=\"border-none z-50 shadow-md relative\" >\r\n {/* Sidebar toggle button - right side inside Sidebar */}\r\n {(sidebarState === 'expanded') && (\r\n <div id='sidebar-toggle-button' className={`absolute right-2 top-2 flex items-center justify-center pointer-events-auto z-50 ${isMobile ? '' : ''}`}>\r\n <button onClick={toggleMenuSidebar} className='text-muted-foreground hover:text-primary p-1'>\r\n <LR.X className='w-5' />\r\n </button>\r\n </div>\r\n )}\r\n {/* Show collapsed toggle only on desktop */}\r\n {!isMobile && sidebarState !== 'expanded' && (\r\n <div id='sidebar-toggle-button' className='absolute -right-1 max-h-1 top-1/2 -translate-y-1/2 flex items-center justify-center pointer-events-auto z-50'>\r\n <button\r\n onClick={toggleMenuSidebar}\r\n className=\"text-muted-foreground hover:text-primary p-0 rounded-md bg-sidebar\"\r\n style={{ borderRight: '1px solid rgba(128,128,128,0.2)', boxShadow: '4px 0 8px -4px rgba(0,0,0,0.12)' }}\r\n >\r\n <LR.ChevronRight className=\"w-4\" />\r\n </button>\r\n </div>\r\n )}\r\n {children}\r\n <div className={`w-full flex flex-col ${sidebarState === 'expanded' ? 'items-center justify-center' : 'justify-center'}`}>\r\n {/* Nav User */}\r\n <NavUser signOut={signOut} />\r\n <Link href=\"https://collabdt.org/\" className={sidebarState === 'expanded' ? 'w-full' : ''} target=\"_blank\" rel=\"noopener noreferrer\">\r\n <Button\r\n title={isCollapsed ? t('home') : undefined}\r\n variant=\"ghost\"\r\n className={`text-xs scale-[85%] py-0 my-0 w-full ${sidebarState === 'expanded' ? 'flex flex-row items-center justify-center gap-2' : 'flex flex-col items-center'}`}\r\n >\r\n {!isCollapsed && <CdtIcon monochromatic={true} />}\r\n <span className={isCollapsed ? 'hidden' : 'inline'}>{t('home')}</span>\r\n </Button>\r\n </Link>\r\n </div>\r\n </Sidebar>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AAC,GAAG,GAAH,EAAK,WAAU,OAAM,GACxB,GACF;AAAA,MAGD,CAAC,YAAY,iBAAiB,cAC7B,oBAAC,SAAI,IAAG,yBAAwB,WAAU,gHACxC;AAAA,QAAC;AAAA;AAAA,UACC,SAAS;AAAA,UACT,WAAU;AAAA,UACV,OAAO,EAAE,aAAa,mCAAmC,WAAW,kCAAkC;AAAA,UAEtG,8BAAC,GAAG,cAAH,EAAgB,WAAU,OAAM;AAAA;AAAA,MACnC,GACF;AAAA,MAED;AAAA,MACD,qBAAC,SAAI,WAAW,wBAAwB,iBAAiB,aAAa,gCAAgC,gBAAgB,IAEpH;AAAA,4BAAC,WAAQ,SAAkB;AAAA,QAC3B,oBAAC,QAAK,MAAK,yBAAwB,WAAW,iBAAiB,aAAa,WAAW,IAAI,QAAO,UAAS,KAAI,uBAC7G;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,cAAc,EAAE,MAAM,IAAI;AAAA,YACjC,SAAQ;AAAA,YACR,WAAW,wCAAwC,iBAAiB,aAAa,oDAAoD,4BAA4B;AAAA,YAEhK;AAAA,eAAC,eAAe,oBAAC,WAAQ,eAAe,MAAM;AAAA,cAC/C,oBAAC,UAAK,WAAW,cAAc,WAAW,UAAW,YAAE,MAAM,GAAE;AAAA;AAAA;AAAA,QACjE,GACF;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/components/ui/AppSidebar.tsx"],"sourcesContent":["'use client'\r\nimport * as React from 'react'\r\n\r\n// Dependencies\r\nimport { Button } from './Button'\r\n\r\n// Icons\r\nimport * as LR from 'lucide-react'\r\n\r\nimport { useTranslations } from 'next-intl'\r\nimport { CdtIcon } from './Icons/CdtIcon'\r\nimport Link from 'next/link'\r\nimport { Sidebar, useSidebar, NavUser } from './'\r\nimport { ViewerNames } from '../../types'\r\nimport { useMenusContext } from '../../store'\r\n\r\nexport const handleChangeViewer = (\r\n viewer: ViewerNames,\r\n setSelectedItem: React.Dispatch<React.SetStateAction<any>>,\r\n setSelectedSite: React.Dispatch<React.SetStateAction<any>>,\r\n setSelectedFile: React.Dispatch<React.SetStateAction<any>>,\r\n setView: React.Dispatch<React.SetStateAction<'table' | 'detail'>>,\r\n menusDispatch: any,\r\n) => {\r\n // Reset selected item, file, & view when changing viewer\r\n setSelectedItem(null)\r\n setSelectedSite(null)\r\n setSelectedFile(null)\r\n setView('table')\r\n\r\n menusDispatch({\r\n type: 'SET_VIEWER',\r\n payload: { currentViewer: viewer },\r\n })\r\n}\r\n\r\ninterface AppSidebarProps {\r\n children?: React.ReactNode\r\n signOut: (options?: { redirectTo?: string; redirect?: boolean }) => Promise<void>\r\n}\r\n\r\nexport function AppSidebar({ children, signOut }: AppSidebarProps) {\r\n // Translations\r\n const t = useTranslations('AppSidebar')\r\n\r\n const { state: menusState } = useMenusContext()\r\n\r\n const { sidebarState, isMobile, openMobile, toggleMenuSidebar } = useSidebar()\r\n\r\n const { currentViewer } = menusState.menus\r\n\r\n // On mobile, treat the sheet open as expanded so labels render when the drawer is visible\r\n const isCollapsed = isMobile ? !openMobile : sidebarState === 'collapsed'\r\n\r\n // Determine the collapsible type based on the current viewer\r\n const collapsibleType = currentViewer === ViewerNames.auth ? 'offcanvas' : 'icon'\r\n\r\n return (\r\n <>\r\n {/* Always show toggle button on mobile when collapsed */}\r\n {isMobile && isCollapsed && (\r\n <div id='sidebar-toggle-button-mobile' className='fixed left-0 top-1/2 -translate-y-1/2 z-[100] flex items-center justify-center pointer-events-auto'>\r\n <button\r\n onClick={toggleMenuSidebar}\r\n className=\"text-muted-foreground hover:text-primary p-[2px] rounded-r-md bg-sidebar\"\r\n style={{ border: '1px solid rgba(128,128,128,0.2)', borderLeft: 'none', boxShadow: '4px 0 8px -4px rgba(0,0,0,0.12)' }}\r\n >\r\n <LR.ChevronRight className=\"w-5\" />\r\n </button>\r\n </div>\r\n )}\r\n <Sidebar collapsible={collapsibleType} className=\"border-none z-50 shadow-md relative\" >\r\n {/* Sidebar toggle button - right side inside Sidebar */}\r\n {(sidebarState === 'expanded') && (\r\n <div id='sidebar-toggle-button' className={`absolute right-2 top-2 flex items-center justify-center pointer-events-auto z-50 ${isMobile ? '' : ''}`}>\r\n <button onClick={toggleMenuSidebar} className='text-muted-foreground hover:text-primary p-1'>\r\n <LR.X className='w-5' />\r\n </button>\r\n </div>\r\n )}\r\n {/* Show collapsed toggle only on desktop */}\r\n {!isMobile && sidebarState !== 'expanded' && (\r\n <div id='sidebar-toggle-button' className='absolute -right-1 max-h-1 top-1/2 -translate-y-1/2 flex items-center justify-center pointer-events-auto z-50'>\r\n <button\r\n onClick={toggleMenuSidebar}\r\n className=\"text-muted-foreground hover:text-primary p-0 rounded-md bg-sidebar\"\r\n style={{ borderRight: '1px solid rgba(128,128,128,0.2)', boxShadow: '4px 0 8px -4px rgba(0,0,0,0.12)' }}\r\n >\r\n <LR.ChevronRight className=\"w-4\" />\r\n </button>\r\n </div>\r\n )}\r\n {children}\r\n <div\r\n className={`w-full flex flex-col ${\r\n sidebarState === 'expanded'\r\n ? 'items-center justify-center'\r\n : 'justify-center'\r\n }`}\r\n >\r\n {/* Nav User */}\r\n <NavUser signOut={signOut} />\r\n\r\n <Link\r\n href=\"https://collabdt.org/\"\r\n className={sidebarState === 'expanded' ? 'w-full' : ''}\r\n target=\"_blank\"\r\n rel=\"noopener noreferrer\"\r\n >\r\n <Button\r\n title={isCollapsed ? t('home') : undefined}\r\n variant=\"ghost\"\r\n className={`text-xs scale-[85%] py-0 my-0 w-full ${\r\n sidebarState === 'expanded'\r\n ? 'flex flex-row items-center justify-center gap-2'\r\n : 'flex flex-col items-center'\r\n }`}\r\n >\r\n <>\r\n <div className={isCollapsed ? 'scale-75' : ''}>\r\n <CdtIcon monochromatic />\r\n </div>\r\n\r\n {!isCollapsed && (\r\n <span>{t('home')}</span>\r\n )}\r\n </>\r\n </Button>\r\n </Link>\r\n </div>\r\n </Sidebar>\r\n </>\r\n )\r\n}"],"mappings":";AAmEY,S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,OAAM,GACxB,GACF;AAAA,MAGD,CAAC,YAAY,iBAAiB,cAC7B,oBAAC,SAAI,IAAG,yBAAwB,WAAU,gHACxC;AAAA,QAAC;AAAA;AAAA,UACC,SAAS;AAAA,UACT,WAAU;AAAA,UACV,OAAO,EAAE,aAAa,mCAAmC,WAAW,kCAAkC;AAAA,UAEtG,8BAAC,GAAG,cAAH,EAAgB,WAAU,OAAM;AAAA;AAAA,MACnC,GACF;AAAA,MAED;AAAA,MACD;AAAA,QAAC;AAAA;AAAA,UACG,WAAW,wBACT,iBAAiB,aACb,gCACA,gBACN;AAAA,UAGA;AAAA,gCAAC,WAAQ,SAAkB;AAAA,YAE3B;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,WAAW,iBAAiB,aAAa,WAAW;AAAA,gBACpD,QAAO;AAAA,gBACP,KAAI;AAAA,gBAEJ;AAAA,kBAAC;AAAA;AAAA,oBACC,OAAO,cAAc,EAAE,MAAM,IAAI;AAAA,oBACjC,SAAQ;AAAA,oBACR,WAAW,wCACT,iBAAiB,aACb,oDACA,4BACN;AAAA,oBAEA,2CACA;AAAA,0CAAC,SAAI,WAAW,cAAc,aAAa,IACzC,8BAAC,WAAQ,eAAa,MAAC,GACzB;AAAA,sBAEC,CAAC,eACA,oBAAC,UAAM,YAAE,MAAM,GAAE;AAAA,uBAErB;AAAA;AAAA,gBACA;AAAA;AAAA,YACF;AAAA;AAAA;AAAA,MACF;AAAA,OACJ;AAAA,KACF;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"DatatableFileAdder.d.ts","sourceRoot":"","sources":["../../../../../../src/core/components/viewers/Data/files/DatatableFileAdder.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,MAAM,CAAC,OAAO,UAAU,kBAAkB,sBAqCzC"}
1
+ {"version":3,"file":"DatatableFileAdder.d.ts","sourceRoot":"","sources":["../../../../../../src/core/components/viewers/Data/files/DatatableFileAdder.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B,MAAM,CAAC,OAAO,UAAU,kBAAkB,sBAuCzC"}
@@ -5,6 +5,7 @@ import { usePermissions } from "../../../../store";
5
5
  import { Button, LoadingSpinner } from "../../../../components/ui/";
6
6
  import * as LR from "lucide-react";
7
7
  import { useFileUploadWithProgress } from "../../../../components/ui/FilesManager";
8
+ import { toast } from "sonner";
8
9
  function DatatableFileAdder() {
9
10
  const t = useTranslations("HeadDatatableFileAddererButtons");
10
11
  const { ability } = usePermissions();
@@ -12,9 +13,11 @@ function DatatableFileAdder() {
12
13
  acceptedFileTypes: "*",
13
14
  onUploadSuccess: () => {
14
15
  console.log("File successfully uploaded to API");
16
+ toast.success(t("uploadSuccess"));
15
17
  },
16
18
  onUploadError: (error) => {
17
19
  console.error("Error uploading file:", error);
20
+ toast.error(error.message);
18
21
  }
19
22
  });
20
23
  return /* @__PURE__ */ jsx("div", { className: "inline-block", children: /* @__PURE__ */ jsxs(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/core/components/viewers/Data/files/DatatableFileAdder.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from 'react'\r\nimport { useTranslations } from 'next-intl'\r\nimport { usePermissions } from '../../../../store'\r\n\r\nimport { Button, LoadingSpinner } from '../../../../components/ui/'\r\nimport * as LR from 'lucide-react'\r\nimport { useFileUploadWithProgress } from '../../../../components/ui/FilesManager'\r\n\r\nexport default function DatatableFileAdder() {\r\n\r\n // Translations\r\n const t = useTranslations('HeadDatatableFileAddererButtons')\r\n\r\n // Permissions\r\n const { ability } = usePermissions()\r\n\r\n // Use the reusable upload hook with progress\r\n const { handleAddFile, uploadState } = useFileUploadWithProgress({\r\n acceptedFileTypes: '*',\r\n onUploadSuccess: () => {\r\n console.log('File successfully uploaded to API')\r\n },\r\n onUploadError: (error) => {\r\n console.error('Error uploading file:', error)\r\n }\r\n })\r\n\r\n return (\r\n <div className=\"inline-block\">\r\n <Button \r\n variant=\"default\" \r\n onClick={handleAddFile}\r\n disabled={!ability.can('create', 'File') || uploadState.uploading}\r\n >\r\n {uploadState.uploading\r\n ? (\r\n <LoadingSpinner />\r\n )\r\n : (\r\n <LR.CirclePlus className=\"mr-2\" />\r\n )}\r\n {uploadState.uploading ? `${t('uploading')} ${uploadState.progress}%` : t('addFile')}\r\n </Button>\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AA+BM,SAOQ,KAPR;AA5BN,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAE/B,SAAS,QAAQ,sBAAsB;AACvC,YAAY,QAAQ;AACpB,SAAS,iCAAiC;AAE3B,SAAR,qBAAsC;AAG3C,QAAM,IAAI,gBAAgB,iCAAiC;AAG3D,QAAM,EAAE,QAAQ,IAAI,eAAe;AAGnC,QAAM,EAAE,eAAe,YAAY,IAAI,0BAA0B;AAAA,IAC/D,mBAAmB;AAAA,IACnB,iBAAiB,MAAM;AACrB,cAAQ,IAAI,mCAAmC;AAAA,IACjD;AAAA,IACA,eAAe,CAAC,UAAU;AACxB,cAAQ,MAAM,yBAAyB,KAAK;AAAA,IAC9C;AAAA,EACF,CAAC;AAED,SACE,oBAAC,SAAI,WAAU,gBACb;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU,CAAC,QAAQ,IAAI,UAAU,MAAM,KAAK,YAAY;AAAA,MAEvD;AAAA,oBAAY,YAEP,oBAAC,kBAAe,IAGhB,oBAAC,GAAG,YAAH,EAAc,WAAU,QAAO;AAAA,QAErC,YAAY,YAAY,GAAG,EAAE,WAAW,CAAC,IAAI,YAAY,QAAQ,MAAM,EAAE,SAAS;AAAA;AAAA;AAAA,EACrF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/core/components/viewers/Data/files/DatatableFileAdder.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from 'react'\r\nimport { useTranslations } from 'next-intl'\r\nimport { usePermissions } from '../../../../store'\r\n\r\nimport { Button, LoadingSpinner } from '../../../../components/ui/'\r\nimport * as LR from 'lucide-react'\r\nimport { useFileUploadWithProgress } from '../../../../components/ui/FilesManager'\r\n\r\nimport { toast } from 'sonner'\r\n\r\nexport default function DatatableFileAdder() {\r\n\r\n // Translations\r\n const t = useTranslations('HeadDatatableFileAddererButtons')\r\n\r\n // Permissions\r\n const { ability } = usePermissions()\r\n\r\n // Use the reusable upload hook with progress\r\n const { handleAddFile, uploadState } = useFileUploadWithProgress({\r\n acceptedFileTypes: '*',\r\n onUploadSuccess: () => {\r\n console.log('File successfully uploaded to API')\r\n toast.success(t('uploadSuccess'))\r\n },\r\n onUploadError: (error) => {\r\n console.error('Error uploading file:', error)\r\n toast.error(error.message)\r\n }\r\n })\r\n\r\n return (\r\n <div className=\"inline-block\">\r\n <Button \r\n variant=\"default\" \r\n onClick={handleAddFile}\r\n disabled={!ability.can('create', 'File') || uploadState.uploading}\r\n >\r\n {uploadState.uploading\r\n ? (\r\n <LoadingSpinner />\r\n )\r\n : (\r\n <LR.CirclePlus className=\"mr-2\" />\r\n )}\r\n {uploadState.uploading ? `${t('uploading')} ${uploadState.progress}%` : t('addFile')}\r\n </Button>\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AAmCM,SAOQ,KAPR;AAhCN,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAE/B,SAAS,QAAQ,sBAAsB;AACvC,YAAY,QAAQ;AACpB,SAAS,iCAAiC;AAE1C,SAAS,aAAa;AAEP,SAAR,qBAAsC;AAG3C,QAAM,IAAI,gBAAgB,iCAAiC;AAG3D,QAAM,EAAE,QAAQ,IAAI,eAAe;AAGnC,QAAM,EAAE,eAAe,YAAY,IAAI,0BAA0B;AAAA,IAC/D,mBAAmB;AAAA,IACnB,iBAAiB,MAAM;AACrB,cAAQ,IAAI,mCAAmC;AAC/C,YAAM,QAAQ,EAAE,eAAe,CAAC;AAAA,IAClC;AAAA,IACA,eAAe,CAAC,UAAU;AACxB,cAAQ,MAAM,yBAAyB,KAAK;AAC5C,YAAM,MAAM,MAAM,OAAO;AAAA,IAC3B;AAAA,EACF,CAAC;AAED,SACE,oBAAC,SAAI,WAAU,gBACb;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU,CAAC,QAAQ,IAAI,UAAU,MAAM,KAAK,YAAY;AAAA,MAEvD;AAAA,oBAAY,YAEP,oBAAC,kBAAe,IAGhB,oBAAC,GAAG,YAAH,EAAc,WAAU,QAAO;AAAA,QAErC,YAAY,YAAY,GAAG,EAAE,WAAW,CAAC,IAAI,YAAY,QAAQ,MAAM,EAAE,SAAS;AAAA;AAAA;AAAA,EACrF,GACF;AAEJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collabdt/core",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "description": "CDT Core contains all the core technology for your CDT platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",