@pelatform/starter 0.1.7 → 0.1.8
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.
- package/dist/{chunk-2ZAZ77F6.js → chunk-IEJXTIKE.js} +51 -44
- package/dist/extend.d.ts +2 -7
- package/dist/extend.js +4 -39
- package/dist/index.d.ts +117 -163
- package/dist/index.js +1040 -290
- package/dist/{ui-DxCTGGLe.d.ts → workspace-CcGHPtq0.d.ts} +74 -218
- package/package.json +34 -13
package/dist/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
defaultAuthQueryOptions,
|
|
4
|
-
fileToBase64,
|
|
5
4
|
getPasswordSchema,
|
|
6
5
|
getTranslations,
|
|
7
|
-
|
|
6
|
+
request,
|
|
7
|
+
setLastVisitedWorkspace,
|
|
8
8
|
socialProviders
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IEJXTIKE.js";
|
|
10
|
+
import {
|
|
11
|
+
WORKSPACE_SCOPED_PREFIXES
|
|
12
|
+
} from "./chunk-K5RU54UL.js";
|
|
10
13
|
|
|
11
14
|
// src/config/hook.ts
|
|
12
15
|
import { useContext } from "react";
|
|
@@ -133,7 +136,8 @@ var defaultConfig = {
|
|
|
133
136
|
},
|
|
134
137
|
custom: {
|
|
135
138
|
ACCEPT_INVITATION: "/join",
|
|
136
|
-
NEW_WORKSPACE: "/new"
|
|
139
|
+
NEW_WORKSPACE: "/new",
|
|
140
|
+
VERIFY_EMAIL: "/verify"
|
|
137
141
|
}
|
|
138
142
|
},
|
|
139
143
|
ui: {
|
|
@@ -416,6 +420,7 @@ function useDeletePasskey(options) {
|
|
|
416
420
|
const { queryKey } = useContext8(QueryContext);
|
|
417
421
|
return useAuthMutation({
|
|
418
422
|
queryKey: queryKey.listPasskeys,
|
|
423
|
+
// @ts-expect-error - passkeyClient does not exist
|
|
419
424
|
mutationFn: authClient.passkey.deletePasskey,
|
|
420
425
|
options
|
|
421
426
|
});
|
|
@@ -425,6 +430,7 @@ function useListPasskeys(options) {
|
|
|
425
430
|
const { queryKey } = useContext8(QueryContext);
|
|
426
431
|
return useAuthQuery({
|
|
427
432
|
queryKey: queryKey.listPasskeys,
|
|
433
|
+
// @ts-expect-error - passkeyClient does not exist
|
|
428
434
|
queryFn: authClient.passkey.listUserPasskeys,
|
|
429
435
|
options
|
|
430
436
|
});
|
|
@@ -469,11 +475,27 @@ function useRevokeSessions(options) {
|
|
|
469
475
|
});
|
|
470
476
|
}
|
|
471
477
|
|
|
478
|
+
// src/hooks/use-invitation.ts
|
|
479
|
+
import { useContext as useContext10 } from "react";
|
|
480
|
+
function useInvitation(params, options) {
|
|
481
|
+
const { authClient } = useConfig();
|
|
482
|
+
const { queryKey: key } = useContext10(QueryContext);
|
|
483
|
+
const queryKey = [key.invitationKey, JSON.stringify(params)];
|
|
484
|
+
return useAuthQuery({
|
|
485
|
+
queryKey,
|
|
486
|
+
queryFn: (fnParams) => authClient.organization.getInvitation({
|
|
487
|
+
...params,
|
|
488
|
+
...fnParams
|
|
489
|
+
}),
|
|
490
|
+
options
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
|
|
472
494
|
// src/hooks/use-layout.ts
|
|
473
|
-
import { createContext as createContext2, useContext as
|
|
495
|
+
import { createContext as createContext2, useContext as useContext11 } from "react";
|
|
474
496
|
var LayoutContext = createContext2(void 0);
|
|
475
497
|
var useLayout = () => {
|
|
476
|
-
const context =
|
|
498
|
+
const context = useContext11(LayoutContext);
|
|
477
499
|
if (!context) {
|
|
478
500
|
throw new Error("useLayout must be used within a LayoutProvider");
|
|
479
501
|
}
|
|
@@ -506,10 +528,10 @@ function useOnSuccessTransition(redirectToProp) {
|
|
|
506
528
|
}
|
|
507
529
|
|
|
508
530
|
// src/hooks/use-update-user.ts
|
|
509
|
-
import { useContext as
|
|
531
|
+
import { useContext as useContext12 } from "react";
|
|
510
532
|
function useUpdateUser(options) {
|
|
511
533
|
const { authClient } = useConfig();
|
|
512
|
-
const { queryKey } =
|
|
534
|
+
const { queryKey } = useContext12(QueryContext);
|
|
513
535
|
return useAuthMutation({
|
|
514
536
|
queryKey: queryKey.session,
|
|
515
537
|
mutationFn: authClient.updateUser,
|
|
@@ -521,20 +543,15 @@ function useUpdateUser(options) {
|
|
|
521
543
|
});
|
|
522
544
|
}
|
|
523
545
|
|
|
524
|
-
// src/hooks/use-
|
|
525
|
-
import { useContext as
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
...params,
|
|
534
|
-
...fnParams
|
|
535
|
-
}),
|
|
536
|
-
options
|
|
537
|
-
});
|
|
546
|
+
// src/hooks/use-workspace.ts
|
|
547
|
+
import { createContext as createContext3, useContext as useContext13 } from "react";
|
|
548
|
+
var WorkspaceContext = createContext3(void 0);
|
|
549
|
+
function useWorkspace() {
|
|
550
|
+
const context = useContext13(WorkspaceContext);
|
|
551
|
+
if (context === void 0) {
|
|
552
|
+
throw new Error("useWorkspace must be used within a WorkspaceProvider");
|
|
553
|
+
}
|
|
554
|
+
return context;
|
|
538
555
|
}
|
|
539
556
|
|
|
540
557
|
// src/ui/account/dialogs/backup-codes.tsx
|
|
@@ -1568,6 +1585,7 @@ function DeleteAccountCard({
|
|
|
1568
1585
|
import { useRef, useState as useState5 } from "react";
|
|
1569
1586
|
import { Trash2Icon, UploadCloudIcon } from "lucide-react";
|
|
1570
1587
|
import { useTranslations as useTranslations9 } from "next-intl";
|
|
1588
|
+
import { fileToBase64, resizeAndCropImage } from "pelatform-ui";
|
|
1571
1589
|
import { AlertToast as AlertToast3 } from "pelatform-ui/components";
|
|
1572
1590
|
import {
|
|
1573
1591
|
Button as Button8,
|
|
@@ -2438,6 +2456,7 @@ function PasskeysCard({ className, classNames, ...props }) {
|
|
|
2438
2456
|
isPending: passkeysPending,
|
|
2439
2457
|
refetch: refetchPasskeys
|
|
2440
2458
|
} = useListPasskeys();
|
|
2459
|
+
const typedPasskeys = passkeys;
|
|
2441
2460
|
const isPending = sessionPending || passkeysPending;
|
|
2442
2461
|
const isFresh = session ? Date.now() - new Date(session?.createdAt).getTime() < auth.freshAge * 1e3 : false;
|
|
2443
2462
|
const [showFreshnessDialog, setShowFreshnessDialog] = useState8(false);
|
|
@@ -2479,7 +2498,7 @@ function PasskeysCard({ className, classNames, ...props }) {
|
|
|
2479
2498
|
actionLabel: t("systems.ADD_PASSKEY"),
|
|
2480
2499
|
isPending,
|
|
2481
2500
|
...props,
|
|
2482
|
-
children: isPending ? /* @__PURE__ */ jsx20("div", { className: cn15("grid gap-4", classNames?.grid), children: /* @__PURE__ */ jsx20(SkeletonViewComponent, { classNames }) }) :
|
|
2501
|
+
children: isPending ? /* @__PURE__ */ jsx20("div", { className: cn15("grid gap-4", classNames?.grid), children: /* @__PURE__ */ jsx20(SkeletonViewComponent, { classNames }) }) : typedPasskeys && typedPasskeys.length > 0 && /* @__PURE__ */ jsx20("div", { className: cn15("grid gap-4", classNames?.grid), children: typedPasskeys.map((passkey) => /* @__PURE__ */ jsx20(PasskeyCell, { classNames, passkey }, passkey.id)) })
|
|
2483
2502
|
}
|
|
2484
2503
|
) }) })
|
|
2485
2504
|
] });
|
|
@@ -5371,9 +5390,9 @@ function AuthForm({
|
|
|
5371
5390
|
}
|
|
5372
5391
|
|
|
5373
5392
|
// src/ui/layouts/auth.tsx
|
|
5374
|
-
import
|
|
5393
|
+
import Link6 from "next/link";
|
|
5375
5394
|
import { usePathname } from "next/navigation";
|
|
5376
|
-
import { useTranslations as
|
|
5395
|
+
import { useTranslations as useTranslations44 } from "next-intl";
|
|
5377
5396
|
import { LayoutBlank } from "pelatform-ui/components";
|
|
5378
5397
|
|
|
5379
5398
|
// src/ui/shared/logo.tsx
|
|
@@ -5396,15 +5415,33 @@ function LogoWithHref({ className, href = "/" }) {
|
|
|
5396
5415
|
] });
|
|
5397
5416
|
}
|
|
5398
5417
|
|
|
5399
|
-
// src/ui/
|
|
5418
|
+
// src/ui/shared/signed-in-hint.tsx
|
|
5419
|
+
import Link5 from "next/link";
|
|
5400
5420
|
import { useTranslations as useTranslations41 } from "next-intl";
|
|
5421
|
+
import { Button as Button31 } from "pelatform-ui/default";
|
|
5422
|
+
import { jsx as jsx49, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5423
|
+
function SignedInHint({ linkHref = "/signin" }) {
|
|
5424
|
+
const t = useTranslations41("customs.common.signed");
|
|
5425
|
+
const { isPending, user } = useSession();
|
|
5426
|
+
return /* @__PURE__ */ jsxs42("div", { className: "fixed start-0 bottom-0 z-40 m-5 flex flex-col gap-2", children: [
|
|
5427
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex items-center gap-1 text-muted-foreground text-xs", children: [
|
|
5428
|
+
t("text"),
|
|
5429
|
+
" ",
|
|
5430
|
+
isPending || !user ? /* @__PURE__ */ jsx49("span", { className: "h-3 w-32 animate-pulse rounded-md border bg-muted-foreground" }) : /* @__PURE__ */ jsx49("b", { className: "text-foreground", children: user.email })
|
|
5431
|
+
] }),
|
|
5432
|
+
/* @__PURE__ */ jsx49(Button31, { variant: "mono", className: "h-8 w-fit rounded-lg px-3 text-xs shadow-sm", children: /* @__PURE__ */ jsx49(Link5, { href: linkHref, children: t("button") }) })
|
|
5433
|
+
] });
|
|
5434
|
+
}
|
|
5435
|
+
|
|
5436
|
+
// src/ui/layouts/loader.tsx
|
|
5437
|
+
import { useTranslations as useTranslations42 } from "next-intl";
|
|
5401
5438
|
import { ScreenLoader } from "pelatform-ui/components";
|
|
5402
|
-
import { jsx as
|
|
5439
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
5403
5440
|
function LayoutLoader({ children }) {
|
|
5404
|
-
const t =
|
|
5441
|
+
const t = useTranslations42();
|
|
5405
5442
|
const { isPending } = useSession();
|
|
5406
5443
|
if (isPending) {
|
|
5407
|
-
return /* @__PURE__ */
|
|
5444
|
+
return /* @__PURE__ */ jsx50(ScreenLoader, { loadingText: t("systems.common.status.loading") });
|
|
5408
5445
|
}
|
|
5409
5446
|
return children;
|
|
5410
5447
|
}
|
|
@@ -5417,11 +5454,11 @@ import { ModeSwitcher } from "pelatform-ui/components";
|
|
|
5417
5454
|
// src/ui/shared/language-switcher.tsx
|
|
5418
5455
|
import Image from "next/image";
|
|
5419
5456
|
import { useRouter as useRouter14 } from "next/navigation";
|
|
5420
|
-
import { useLocale as useLocale3, useTranslations as
|
|
5457
|
+
import { useLocale as useLocale3, useTranslations as useTranslations43 } from "next-intl";
|
|
5421
5458
|
import {
|
|
5422
5459
|
LanguageSwitcher as LanguageSwitcherBase
|
|
5423
5460
|
} from "pelatform-ui/components";
|
|
5424
|
-
import { jsx as
|
|
5461
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
5425
5462
|
function LanguageSwitcher({
|
|
5426
5463
|
className,
|
|
5427
5464
|
type,
|
|
@@ -5432,7 +5469,7 @@ function LanguageSwitcher({
|
|
|
5432
5469
|
}) {
|
|
5433
5470
|
const { i18n } = useConfig();
|
|
5434
5471
|
const router = useRouter14();
|
|
5435
|
-
const t =
|
|
5472
|
+
const t = useTranslations43();
|
|
5436
5473
|
const currentLocale = useLocale3();
|
|
5437
5474
|
const availableLocales = (() => {
|
|
5438
5475
|
if (!i18n.enabled) {
|
|
@@ -5456,7 +5493,7 @@ function LanguageSwitcher({
|
|
|
5456
5493
|
document.cookie = `${i18n.localeCookieName}=${newLocale}; max-age=${60 * 60 * 24 * 365}; path=/`;
|
|
5457
5494
|
router.refresh();
|
|
5458
5495
|
}
|
|
5459
|
-
return /* @__PURE__ */
|
|
5496
|
+
return /* @__PURE__ */ jsx51(
|
|
5460
5497
|
LanguageSwitcherBase,
|
|
5461
5498
|
{
|
|
5462
5499
|
className,
|
|
@@ -5477,34 +5514,37 @@ function LanguageSwitcher({
|
|
|
5477
5514
|
}
|
|
5478
5515
|
|
|
5479
5516
|
// src/ui/layouts/toolbar.tsx
|
|
5480
|
-
import { jsx as
|
|
5517
|
+
import { jsx as jsx52, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
5481
5518
|
var DEFAULT_SHOW = ["darkmode"];
|
|
5482
5519
|
function Toolbar(props) {
|
|
5483
|
-
return /* @__PURE__ */
|
|
5520
|
+
return /* @__PURE__ */ jsx52(Suspense, { fallback: null, children: /* @__PURE__ */ jsx52("div", { className: cn40("fixed end-0 bottom-0 z-40 m-5", props.className), children: /* @__PURE__ */ jsx52(ToolbarRSC, { ...props }) }) });
|
|
5484
5521
|
}
|
|
5485
5522
|
function ToolbarRSC({ show = DEFAULT_SHOW }) {
|
|
5486
|
-
return /* @__PURE__ */
|
|
5487
|
-
show.includes("darkmode") && /* @__PURE__ */
|
|
5488
|
-
show.includes("help") && /* @__PURE__ */
|
|
5489
|
-
show.includes("language") && /* @__PURE__ */
|
|
5490
|
-
show.includes("onboarding") && /* @__PURE__ */
|
|
5523
|
+
return /* @__PURE__ */ jsx52("div", { className: "flex flex-col items-center gap-2.5", children: /* @__PURE__ */ jsxs43("div", { className: "shrink-0", children: [
|
|
5524
|
+
show.includes("darkmode") && /* @__PURE__ */ jsx52(ModeSwitcher, { variant: "outline", size: "lg", className: "size-10 rounded-full border" }),
|
|
5525
|
+
show.includes("help") && /* @__PURE__ */ jsx52("div", { className: "hidden" }),
|
|
5526
|
+
show.includes("language") && /* @__PURE__ */ jsx52(LanguageSwitcher, { variant: "outline", size: "lg", className: "size-10 rounded-full border" }),
|
|
5527
|
+
show.includes("onboarding") && /* @__PURE__ */ jsx52("div", { className: "hidden" })
|
|
5491
5528
|
] }) });
|
|
5492
5529
|
}
|
|
5493
5530
|
|
|
5494
5531
|
// src/ui/layouts/auth.tsx
|
|
5495
|
-
import { jsx as
|
|
5532
|
+
import { jsx as jsx53, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
5496
5533
|
function AuthLayout({
|
|
5497
5534
|
children,
|
|
5498
|
-
logo = /* @__PURE__ */
|
|
5535
|
+
logo = /* @__PURE__ */ jsx53(LogoWithName, {}),
|
|
5536
|
+
disableFooter = false,
|
|
5537
|
+
signInHint = false,
|
|
5538
|
+
signInHref
|
|
5499
5539
|
}) {
|
|
5500
5540
|
const { app, path } = useConfig();
|
|
5501
5541
|
const pathname = usePathname();
|
|
5502
|
-
const t =
|
|
5503
|
-
const footer = /* @__PURE__ */
|
|
5542
|
+
const t = useTranslations44();
|
|
5543
|
+
const footer = /* @__PURE__ */ jsxs44("p", { className: "px-20 py-4 text-center font-medium text-muted-foreground text-xs md:px-0", children: [
|
|
5504
5544
|
t("customs.common.agree"),
|
|
5505
5545
|
" ",
|
|
5506
|
-
/* @__PURE__ */
|
|
5507
|
-
|
|
5546
|
+
/* @__PURE__ */ jsx53(
|
|
5547
|
+
Link6,
|
|
5508
5548
|
{
|
|
5509
5549
|
href: path.main.TERMS,
|
|
5510
5550
|
target: "_blank",
|
|
@@ -5513,8 +5553,8 @@ function AuthLayout({
|
|
|
5513
5553
|
}
|
|
5514
5554
|
),
|
|
5515
5555
|
" ",
|
|
5516
|
-
/* @__PURE__ */
|
|
5517
|
-
|
|
5556
|
+
/* @__PURE__ */ jsx53(
|
|
5557
|
+
Link6,
|
|
5518
5558
|
{
|
|
5519
5559
|
href: path.main.PRIVACY,
|
|
5520
5560
|
target: "_blank",
|
|
@@ -5523,19 +5563,20 @@ function AuthLayout({
|
|
|
5523
5563
|
}
|
|
5524
5564
|
)
|
|
5525
5565
|
] });
|
|
5526
|
-
return /* @__PURE__ */
|
|
5527
|
-
/* @__PURE__ */
|
|
5528
|
-
/* @__PURE__ */
|
|
5566
|
+
return /* @__PURE__ */ jsxs44(LayoutLoader, { children: [
|
|
5567
|
+
/* @__PURE__ */ jsx53(Toolbar, { show: ["language"], className: "top-0!" }),
|
|
5568
|
+
/* @__PURE__ */ jsx53(
|
|
5529
5569
|
LayoutBlank,
|
|
5530
5570
|
{
|
|
5531
5571
|
className: "[&_.max-w-4xl]:max-w-sm [&_.max-w-4xl]:px-0",
|
|
5532
5572
|
logo,
|
|
5533
5573
|
logoHref: app.url,
|
|
5534
|
-
footer: pathname === path.auth.SIGN_OUT || pathname === path.auth.CALLBACK ? null : footer,
|
|
5574
|
+
footer: disableFooter || pathname === path.auth.SIGN_OUT || pathname === path.auth.CALLBACK ? null : footer,
|
|
5535
5575
|
children
|
|
5536
5576
|
}
|
|
5537
5577
|
),
|
|
5538
|
-
/* @__PURE__ */
|
|
5578
|
+
/* @__PURE__ */ jsx53(Toolbar, { show: ["darkmode"] }),
|
|
5579
|
+
signInHint && /* @__PURE__ */ jsx53(SignedInHint, { linkHref: signInHref || path.auth.SIGN_OUT })
|
|
5539
5580
|
] });
|
|
5540
5581
|
}
|
|
5541
5582
|
|
|
@@ -5544,7 +5585,7 @@ import { useEffect as useEffect15, useState as useState18 } from "react";
|
|
|
5544
5585
|
import { usePathname as usePathname2 } from "next/navigation";
|
|
5545
5586
|
import { Menu, PanelRight } from "lucide-react";
|
|
5546
5587
|
import {
|
|
5547
|
-
Button as
|
|
5588
|
+
Button as Button32,
|
|
5548
5589
|
Sheet,
|
|
5549
5590
|
SheetBody,
|
|
5550
5591
|
SheetContent,
|
|
@@ -5556,10 +5597,10 @@ import {
|
|
|
5556
5597
|
|
|
5557
5598
|
// src/ui/shared/user-menu.tsx
|
|
5558
5599
|
import { Fragment as Fragment17, useCallback as useCallback3, useEffect as useEffect14, useState as useState17 } from "react";
|
|
5559
|
-
import
|
|
5600
|
+
import Link7 from "next/link";
|
|
5560
5601
|
import { useRouter as useRouter15 } from "next/navigation";
|
|
5561
5602
|
import { LogOut, PlusCircleIcon, Settings, Shield, UserStar } from "lucide-react";
|
|
5562
|
-
import { useTranslations as
|
|
5603
|
+
import { useTranslations as useTranslations45 } from "next-intl";
|
|
5563
5604
|
import { ModeSwitcher as ModeSwitcher2, UserAvatar as UserAvatar2 } from "pelatform-ui/components";
|
|
5564
5605
|
import {
|
|
5565
5606
|
Badge as Badge2,
|
|
@@ -5570,11 +5611,11 @@ import {
|
|
|
5570
5611
|
DropdownMenuTrigger as DropdownMenuTrigger3,
|
|
5571
5612
|
Skeleton as Skeleton9
|
|
5572
5613
|
} from "pelatform-ui/default";
|
|
5573
|
-
import { Fragment as Fragment18, jsx as
|
|
5614
|
+
import { Fragment as Fragment18, jsx as jsx54, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
5574
5615
|
function UserMenu({ hiddenSwitcher = false }) {
|
|
5575
5616
|
const { features, path } = useConfig();
|
|
5576
5617
|
const router = useRouter15();
|
|
5577
|
-
const t =
|
|
5618
|
+
const t = useTranslations45();
|
|
5578
5619
|
const { isPending: sessionPending, user } = useSession();
|
|
5579
5620
|
const { setActiveSessionAsync } = useSetActiveSession();
|
|
5580
5621
|
const { data: deviceSessions, isPending: deviceSessionsPending } = useListDeviceSessions({
|
|
@@ -5607,33 +5648,33 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5607
5648
|
const userName = getName(user);
|
|
5608
5649
|
const userAvatar = user?.image || void 0;
|
|
5609
5650
|
const userRole = user?.role || "user";
|
|
5610
|
-
return /* @__PURE__ */
|
|
5611
|
-
/* @__PURE__ */
|
|
5612
|
-
/* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5614
|
-
/* @__PURE__ */
|
|
5615
|
-
/* @__PURE__ */
|
|
5616
|
-
/* @__PURE__ */
|
|
5617
|
-
/* @__PURE__ */
|
|
5618
|
-
/* @__PURE__ */
|
|
5651
|
+
return /* @__PURE__ */ jsxs45(DropdownMenu3, { children: [
|
|
5652
|
+
/* @__PURE__ */ jsx54(DropdownMenuTrigger3, { className: "focus:outline-none focus:ring-0", children: isPending ? /* @__PURE__ */ jsx54(Skeleton9, { className: "size-8 shrink-0 rounded-full" }) : /* @__PURE__ */ jsx54(UserAvatar2, { className: "size-8", indicator: true, src: userAvatar, alt: userName }) }),
|
|
5653
|
+
/* @__PURE__ */ jsxs45(DropdownMenuContent3, { className: "w-56", side: "bottom", align: "end", sideOffset: 11, children: [
|
|
5654
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-3 px-3 py-2", children: [
|
|
5655
|
+
/* @__PURE__ */ jsx54(UserAvatar2, { src: userAvatar, alt: userName }),
|
|
5656
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex min-w-0 flex-1 flex-col items-start", children: [
|
|
5657
|
+
/* @__PURE__ */ jsx54("span", { className: "truncate font-semibold text-foreground text-sm", children: userName }),
|
|
5658
|
+
/* @__PURE__ */ jsx54("span", { className: "block w-full truncate text-muted-foreground text-xs", children: userEmail }),
|
|
5659
|
+
/* @__PURE__ */ jsx54(Badge2, { variant: "success", appearance: "outline", size: "sm", className: "mt-1", children: userRole.toUpperCase() })
|
|
5619
5660
|
] })
|
|
5620
5661
|
] }),
|
|
5621
|
-
/* @__PURE__ */
|
|
5622
|
-
/* @__PURE__ */
|
|
5623
|
-
/* @__PURE__ */
|
|
5624
|
-
/* @__PURE__ */
|
|
5662
|
+
/* @__PURE__ */ jsx54(DropdownMenuSeparator, {}),
|
|
5663
|
+
/* @__PURE__ */ jsx54(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs45(Link7, { href: path.account.SETTINGS, children: [
|
|
5664
|
+
/* @__PURE__ */ jsx54(Settings, {}),
|
|
5665
|
+
/* @__PURE__ */ jsx54("span", { children: t("systems.navigation.preferences") })
|
|
5625
5666
|
] }) }),
|
|
5626
|
-
/* @__PURE__ */
|
|
5627
|
-
/* @__PURE__ */
|
|
5628
|
-
/* @__PURE__ */
|
|
5667
|
+
/* @__PURE__ */ jsx54(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs45(Link7, { href: path.account.SECURITY, children: [
|
|
5668
|
+
/* @__PURE__ */ jsx54(Shield, {}),
|
|
5669
|
+
/* @__PURE__ */ jsx54("span", { children: t("systems.navigation.security") })
|
|
5629
5670
|
] }) }),
|
|
5630
|
-
"admin" === userRole && /* @__PURE__ */
|
|
5631
|
-
/* @__PURE__ */
|
|
5632
|
-
/* @__PURE__ */
|
|
5671
|
+
"admin" === userRole && /* @__PURE__ */ jsx54(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs45(Link7, { href: path.admin.OVERVIEW, children: [
|
|
5672
|
+
/* @__PURE__ */ jsx54(UserStar, {}),
|
|
5673
|
+
/* @__PURE__ */ jsx54("span", { children: "Admin Dashboard" })
|
|
5633
5674
|
] }) }),
|
|
5634
|
-
!hiddenSwitcher && /* @__PURE__ */
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5675
|
+
!hiddenSwitcher && /* @__PURE__ */ jsxs45(Fragment18, { children: [
|
|
5676
|
+
/* @__PURE__ */ jsx54(DropdownMenuSeparator, {}),
|
|
5677
|
+
/* @__PURE__ */ jsx54(
|
|
5637
5678
|
ModeSwitcher2,
|
|
5638
5679
|
{
|
|
5639
5680
|
type: "sub-dropdown",
|
|
@@ -5644,31 +5685,31 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5644
5685
|
}
|
|
5645
5686
|
}
|
|
5646
5687
|
),
|
|
5647
|
-
/* @__PURE__ */
|
|
5688
|
+
/* @__PURE__ */ jsx54(LanguageSwitcher, { type: "sub-dropdown" })
|
|
5648
5689
|
] }),
|
|
5649
|
-
/* @__PURE__ */
|
|
5650
|
-
/* @__PURE__ */
|
|
5651
|
-
/* @__PURE__ */
|
|
5652
|
-
/* @__PURE__ */
|
|
5690
|
+
/* @__PURE__ */ jsx54(DropdownMenuSeparator, {}),
|
|
5691
|
+
/* @__PURE__ */ jsx54(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs45(Link7, { href: path.auth.SIGN_OUT, children: [
|
|
5692
|
+
/* @__PURE__ */ jsx54(LogOut, {}),
|
|
5693
|
+
/* @__PURE__ */ jsx54("span", { children: t("systems.navigation.logout") })
|
|
5653
5694
|
] }) }),
|
|
5654
|
-
user && features.multiSession && /* @__PURE__ */
|
|
5655
|
-
/* @__PURE__ */
|
|
5656
|
-
!deviceSessions && deviceSessionsPending && /* @__PURE__ */
|
|
5657
|
-
/* @__PURE__ */
|
|
5658
|
-
/* @__PURE__ */
|
|
5695
|
+
user && features.multiSession && /* @__PURE__ */ jsxs45(Fragment18, { children: [
|
|
5696
|
+
/* @__PURE__ */ jsx54(DropdownMenuSeparator, {}),
|
|
5697
|
+
!deviceSessions && deviceSessionsPending && /* @__PURE__ */ jsxs45(Fragment18, { children: [
|
|
5698
|
+
/* @__PURE__ */ jsx54(DropdownMenuItem3, { disabled: true, children: /* @__PURE__ */ jsx54(UserView, { isPending: true }) }),
|
|
5699
|
+
/* @__PURE__ */ jsx54(DropdownMenuSeparator, {})
|
|
5659
5700
|
] }),
|
|
5660
|
-
deviceSessions?.filter((sessionData) => sessionData.user.id !== user?.id).map(({ session, user: multiUser }) => /* @__PURE__ */
|
|
5661
|
-
/* @__PURE__ */
|
|
5662
|
-
/* @__PURE__ */
|
|
5663
|
-
/* @__PURE__ */
|
|
5664
|
-
/* @__PURE__ */
|
|
5665
|
-
/* @__PURE__ */
|
|
5701
|
+
deviceSessions?.filter((sessionData) => sessionData.user.id !== user?.id).map(({ session, user: multiUser }) => /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
5702
|
+
/* @__PURE__ */ jsxs45(DropdownMenuItem3, { onClick: () => switchAccount(session.token), children: [
|
|
5703
|
+
/* @__PURE__ */ jsx54(UserAvatar2, { src: multiUser?.image || void 0, alt: getName(multiUser) }),
|
|
5704
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex min-w-0 flex-1 flex-col items-start", children: [
|
|
5705
|
+
/* @__PURE__ */ jsx54("span", { className: "truncate font-semibold text-foreground text-xs", children: getName(multiUser) }),
|
|
5706
|
+
/* @__PURE__ */ jsx54("span", { className: "block w-full truncate text-muted-foreground text-xs", children: multiUser?.email })
|
|
5666
5707
|
] })
|
|
5667
5708
|
] }),
|
|
5668
|
-
/* @__PURE__ */
|
|
5709
|
+
/* @__PURE__ */ jsx54(DropdownMenuSeparator, {})
|
|
5669
5710
|
] }, session.id)),
|
|
5670
|
-
/* @__PURE__ */
|
|
5671
|
-
/* @__PURE__ */
|
|
5711
|
+
/* @__PURE__ */ jsx54(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs45(Link7, { href: path.auth.SIGN_IN, children: [
|
|
5712
|
+
/* @__PURE__ */ jsx54(PlusCircleIcon, {}),
|
|
5672
5713
|
t("systems.ADD_ACCOUNT")
|
|
5673
5714
|
] }) })
|
|
5674
5715
|
] })
|
|
@@ -5677,32 +5718,32 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5677
5718
|
}
|
|
5678
5719
|
|
|
5679
5720
|
// src/ui/layouts/header.tsx
|
|
5680
|
-
import { jsx as
|
|
5721
|
+
import { jsx as jsx55, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
5681
5722
|
function Header({ children }) {
|
|
5682
|
-
return /* @__PURE__ */
|
|
5723
|
+
return /* @__PURE__ */ jsx55("header", { className: "fixed start-0 end-0 top-0 z-10 flex h-(--header-height-mobile) shrink-0 items-stretch border-border border-b bg-background/95 pe-(--removed-body-scroll-bar-size,0px) backdrop-blur-sm supports-backdrop-filter:bg-background/60 lg:h-(--header-height)", children: /* @__PURE__ */ jsx55("div", { className: "@container flex grow items-stretch justify-between gap-2.5 pe-5", children }) });
|
|
5683
5724
|
}
|
|
5684
5725
|
function HeaderLeft() {
|
|
5685
5726
|
const { logoHeader, sidebarToggle } = useLayout();
|
|
5686
|
-
return /* @__PURE__ */
|
|
5727
|
+
return /* @__PURE__ */ jsx55("div", { className: "flex items-center gap-2 px-5 lg:w-(--sidebar-width)", children: /* @__PURE__ */ jsxs46("div", { className: "flex w-full items-center justify-between", children: [
|
|
5687
5728
|
logoHeader,
|
|
5688
|
-
/* @__PURE__ */
|
|
5689
|
-
|
|
5729
|
+
/* @__PURE__ */ jsx55(
|
|
5730
|
+
Button32,
|
|
5690
5731
|
{
|
|
5691
5732
|
mode: "icon",
|
|
5692
5733
|
variant: "ghost",
|
|
5693
5734
|
onClick: sidebarToggle,
|
|
5694
5735
|
className: "hidden text-muted-foreground hover:text-foreground lg:inline-flex",
|
|
5695
|
-
children: /* @__PURE__ */
|
|
5736
|
+
children: /* @__PURE__ */ jsx55(PanelRight, { className: "-rotate-180 in-data-[sidebar-open=false]:rotate-0 opacity-100" })
|
|
5696
5737
|
}
|
|
5697
5738
|
)
|
|
5698
5739
|
] }) });
|
|
5699
5740
|
}
|
|
5700
5741
|
function HeaderRight({ sidebar, button }) {
|
|
5701
5742
|
const { isMobile } = useLayout();
|
|
5702
|
-
return /* @__PURE__ */
|
|
5743
|
+
return /* @__PURE__ */ jsxs46("nav", { className: "flex items-center gap-1.5 lg:gap-2.5", children: [
|
|
5703
5744
|
button,
|
|
5704
5745
|
isMobile && sidebar,
|
|
5705
|
-
/* @__PURE__ */
|
|
5746
|
+
/* @__PURE__ */ jsx55(UserMenu, {})
|
|
5706
5747
|
] });
|
|
5707
5748
|
}
|
|
5708
5749
|
function HeaderSidebarMobile({ children }) {
|
|
@@ -5711,23 +5752,23 @@ function HeaderSidebarMobile({ children }) {
|
|
|
5711
5752
|
useEffect15(() => {
|
|
5712
5753
|
setIsSheetOpen(false);
|
|
5713
5754
|
}, [pathname]);
|
|
5714
|
-
return /* @__PURE__ */
|
|
5715
|
-
/* @__PURE__ */
|
|
5716
|
-
/* @__PURE__ */
|
|
5717
|
-
/* @__PURE__ */
|
|
5718
|
-
/* @__PURE__ */
|
|
5719
|
-
/* @__PURE__ */
|
|
5755
|
+
return /* @__PURE__ */ jsxs46(Sheet, { open: isSheetOpen, onOpenChange: setIsSheetOpen, children: [
|
|
5756
|
+
/* @__PURE__ */ jsx55(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsx55(Button32, { variant: "ghost", mode: "icon", size: "icon", children: /* @__PURE__ */ jsx55(Menu, { className: "size-4" }) }) }),
|
|
5757
|
+
/* @__PURE__ */ jsxs46(SheetContent, { className: "w-(--sidebar-width) gap-0 p-0", side: "left", close: false, children: [
|
|
5758
|
+
/* @__PURE__ */ jsxs46(SheetHeader, { className: "hidden space-y-0 p-0", children: [
|
|
5759
|
+
/* @__PURE__ */ jsx55(SheetTitle, { className: "sr-only", children: "Navigation menu" }),
|
|
5760
|
+
/* @__PURE__ */ jsx55(SheetDescription, { className: "sr-only", children: "NavigatSheet Description" })
|
|
5720
5761
|
] }),
|
|
5721
|
-
/* @__PURE__ */
|
|
5762
|
+
/* @__PURE__ */ jsx55(SheetBody, { className: "flex grow flex-col p-0", children })
|
|
5722
5763
|
] })
|
|
5723
5764
|
] });
|
|
5724
5765
|
}
|
|
5725
5766
|
|
|
5726
5767
|
// src/ui/layouts/sidebar.tsx
|
|
5727
5768
|
import { useCallback as useCallback4, useMemo as useMemo5 } from "react";
|
|
5728
|
-
import
|
|
5769
|
+
import Link8 from "next/link";
|
|
5729
5770
|
import { usePathname as usePathname3 } from "next/navigation";
|
|
5730
|
-
import { useTranslations as
|
|
5771
|
+
import { useTranslations as useTranslations47 } from "next-intl";
|
|
5731
5772
|
import { BackLink } from "pelatform-ui/components";
|
|
5732
5773
|
import {
|
|
5733
5774
|
AccordionMenu,
|
|
@@ -5738,29 +5779,221 @@ import {
|
|
|
5738
5779
|
AccordionMenuSub,
|
|
5739
5780
|
AccordionMenuSubContent,
|
|
5740
5781
|
AccordionMenuSubTrigger,
|
|
5741
|
-
Badge as
|
|
5782
|
+
Badge as Badge4,
|
|
5742
5783
|
ScrollArea
|
|
5743
5784
|
} from "pelatform-ui/default";
|
|
5744
|
-
|
|
5785
|
+
|
|
5786
|
+
// src/ui/workspace/switcher.tsx
|
|
5787
|
+
import { useRouter as useRouter16 } from "next/navigation";
|
|
5788
|
+
import { Building2, CheckIcon as CheckIcon4, ChevronsUpDown, PlusIcon, User } from "lucide-react";
|
|
5789
|
+
import { useTranslations as useTranslations46 } from "next-intl";
|
|
5790
|
+
import { AlertToast as AlertToast24 } from "pelatform-ui/components";
|
|
5791
|
+
import {
|
|
5792
|
+
Badge as Badge3,
|
|
5793
|
+
Button as Button33,
|
|
5794
|
+
DropdownMenu as DropdownMenu4,
|
|
5795
|
+
DropdownMenuContent as DropdownMenuContent4,
|
|
5796
|
+
DropdownMenuGroup,
|
|
5797
|
+
DropdownMenuItem as DropdownMenuItem4,
|
|
5798
|
+
DropdownMenuLabel,
|
|
5799
|
+
DropdownMenuSeparator as DropdownMenuSeparator2,
|
|
5800
|
+
DropdownMenuTrigger as DropdownMenuTrigger4,
|
|
5801
|
+
Skeleton as Skeleton10
|
|
5802
|
+
} from "pelatform-ui/default";
|
|
5803
|
+
import { useMediaQuery } from "pelatform-ui/hooks";
|
|
5804
|
+
import { jsx as jsx56, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
5805
|
+
function WorkspaceSwitcher() {
|
|
5806
|
+
const { path } = useConfig();
|
|
5807
|
+
const router = useRouter16();
|
|
5808
|
+
const t = useTranslations46();
|
|
5809
|
+
const { activeWorkspace, updateActiveWorkspace, workspaceList, isFetchingWorkspace } = useWorkspace();
|
|
5810
|
+
const ownedWorkspaces = workspaceList?.filter((workspace) => workspace.currentUserRole === "owner") || [];
|
|
5811
|
+
const sharedWorkspaces = workspaceList?.filter((workspace) => workspace.currentUserRole !== "owner") || [];
|
|
5812
|
+
async function switchWorkspace(org) {
|
|
5813
|
+
if (org.slug === activeWorkspace?.slug) {
|
|
5814
|
+
return;
|
|
5815
|
+
}
|
|
5816
|
+
try {
|
|
5817
|
+
await updateActiveWorkspace(org);
|
|
5818
|
+
} catch (error) {
|
|
5819
|
+
console.error("Failed to switch workspace:", error);
|
|
5820
|
+
AlertToast24({
|
|
5821
|
+
message: error instanceof Error ? error.message : "Failed to switch workspace",
|
|
5822
|
+
icon: "destructive"
|
|
5823
|
+
});
|
|
5824
|
+
}
|
|
5825
|
+
}
|
|
5826
|
+
const showSkeleton = !activeWorkspace && isFetchingWorkspace;
|
|
5827
|
+
const currentSlug = activeWorkspace?.slug;
|
|
5828
|
+
const currentName = activeWorkspace?.name ?? "Workspace";
|
|
5829
|
+
const plan = activeWorkspace?.subscription?.plan ?? "free";
|
|
5830
|
+
const isMobile = useMediaQuery("(max-width: 640px)");
|
|
5831
|
+
return /* @__PURE__ */ jsx56("div", { className: "flex h-14 shrink-0 items-center gap-2 border-border border-b px-2.5 lg:h-15", children: /* @__PURE__ */ jsxs47(DropdownMenu4, { children: [
|
|
5832
|
+
activeWorkspace && !showSkeleton ? /* @__PURE__ */ jsx56(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs47(
|
|
5833
|
+
Button33,
|
|
5834
|
+
{
|
|
5835
|
+
variant: "ghost",
|
|
5836
|
+
className: "flex w-full items-center justify-between gap-2 px-1.5 hover:bg-accent focus:shadow-none! focus:outline-none! focus:ring-0! focus:ring-offset-0!",
|
|
5837
|
+
children: [
|
|
5838
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-2.5", children: [
|
|
5839
|
+
/* @__PURE__ */ jsx56(
|
|
5840
|
+
WorkspaceLogo,
|
|
5841
|
+
{
|
|
5842
|
+
workspace: activeWorkspace,
|
|
5843
|
+
classNames: { image: "w-full h-full" }
|
|
5844
|
+
}
|
|
5845
|
+
),
|
|
5846
|
+
/* @__PURE__ */ jsx56("span", { className: "font-medium text-foreground text-sm", children: currentName })
|
|
5847
|
+
] }),
|
|
5848
|
+
/* @__PURE__ */ jsx56(ChevronsUpDown, {})
|
|
5849
|
+
]
|
|
5850
|
+
}
|
|
5851
|
+
) }) : /* @__PURE__ */ jsxs47("div", { className: "flex items-center rounded-md border bg-sidebar-accent", children: [
|
|
5852
|
+
/* @__PURE__ */ jsx56(Skeleton10, { className: "shrink-0 rounded-md border" }),
|
|
5853
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex w-full flex-col gap-1", children: [
|
|
5854
|
+
/* @__PURE__ */ jsx56(Skeleton10, { className: "h-3 w-3/4 border" }),
|
|
5855
|
+
/* @__PURE__ */ jsx56(Skeleton10, { className: "h-3 w-1/2 border" })
|
|
5856
|
+
] })
|
|
5857
|
+
] }),
|
|
5858
|
+
/* @__PURE__ */ jsxs47(
|
|
5859
|
+
DropdownMenuContent4,
|
|
5860
|
+
{
|
|
5861
|
+
className: "w-64",
|
|
5862
|
+
side: isMobile ? "bottom" : "right",
|
|
5863
|
+
align: isMobile ? "end" : "start",
|
|
5864
|
+
sideOffset: isMobile ? 8 : 7,
|
|
5865
|
+
alignOffset: isMobile ? 65 : 0,
|
|
5866
|
+
children: [
|
|
5867
|
+
/* @__PURE__ */ jsxs47(DropdownMenuLabel, { className: "flex items-center gap-1.5", children: [
|
|
5868
|
+
/* @__PURE__ */ jsx56(
|
|
5869
|
+
WorkspaceLogo,
|
|
5870
|
+
{
|
|
5871
|
+
workspace: activeWorkspace,
|
|
5872
|
+
classNames: { image: "w-full h-full" }
|
|
5873
|
+
}
|
|
5874
|
+
),
|
|
5875
|
+
/* @__PURE__ */ jsx56("span", { className: "font-medium text-foreground text-sm", children: currentName }),
|
|
5876
|
+
/* @__PURE__ */ jsx56(Badge3, { size: "xs", className: "capitalize", variant: plan === "free" ? "info" : "success", children: plan })
|
|
5877
|
+
] }),
|
|
5878
|
+
/* @__PURE__ */ jsxs47(
|
|
5879
|
+
DropdownMenuItem4,
|
|
5880
|
+
{
|
|
5881
|
+
className: "cursor-pointer",
|
|
5882
|
+
disabled: !currentSlug,
|
|
5883
|
+
onSelect: () => router.push(`/${currentSlug}${path.workspaces.SETTINGS}`),
|
|
5884
|
+
children: [
|
|
5885
|
+
/* @__PURE__ */ jsx56(Building2, { className: "size-4" }),
|
|
5886
|
+
/* @__PURE__ */ jsx56("span", { children: t("systems.SETTINGS") })
|
|
5887
|
+
]
|
|
5888
|
+
}
|
|
5889
|
+
),
|
|
5890
|
+
/* @__PURE__ */ jsxs47(
|
|
5891
|
+
DropdownMenuItem4,
|
|
5892
|
+
{
|
|
5893
|
+
className: "cursor-pointer",
|
|
5894
|
+
disabled: !currentSlug,
|
|
5895
|
+
onSelect: () => router.push(`/${currentSlug}${path.workspaces.MEMBERS}`),
|
|
5896
|
+
children: [
|
|
5897
|
+
/* @__PURE__ */ jsx56(User, { className: "size-4" }),
|
|
5898
|
+
/* @__PURE__ */ jsx56("span", { children: t("systems.INVITE_MEMBER") })
|
|
5899
|
+
]
|
|
5900
|
+
}
|
|
5901
|
+
),
|
|
5902
|
+
ownedWorkspaces.length > 0 && /* @__PURE__ */ jsxs47(DropdownMenuGroup, { children: [
|
|
5903
|
+
/* @__PURE__ */ jsx56(DropdownMenuSeparator2, {}),
|
|
5904
|
+
/* @__PURE__ */ jsx56(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: t("systems.YOUR_WORKSPACES") }),
|
|
5905
|
+
ownedWorkspaces.map((w) => /* @__PURE__ */ jsxs47(
|
|
5906
|
+
DropdownMenuItem4,
|
|
5907
|
+
{
|
|
5908
|
+
className: "flex items-center justify-between",
|
|
5909
|
+
onClick: () => switchWorkspace(w),
|
|
5910
|
+
disabled: isFetchingWorkspace || w.slug !== currentSlug,
|
|
5911
|
+
children: [
|
|
5912
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-2", children: [
|
|
5913
|
+
/* @__PURE__ */ jsx56(
|
|
5914
|
+
WorkspaceLogo,
|
|
5915
|
+
{
|
|
5916
|
+
workspace: w,
|
|
5917
|
+
classNames: { base: "size-7 rounded-[0.2rem]", image: "w-full h-full" }
|
|
5918
|
+
}
|
|
5919
|
+
),
|
|
5920
|
+
/* @__PURE__ */ jsx56("span", { className: "truncate font-medium text-foreground text-sm leading-5 sm:max-w-[140px]", children: w.name ?? w.slug })
|
|
5921
|
+
] }),
|
|
5922
|
+
w.slug === currentSlug && /* @__PURE__ */ jsx56(CheckIcon4, { className: "size-4 text-primary" })
|
|
5923
|
+
]
|
|
5924
|
+
},
|
|
5925
|
+
w.id
|
|
5926
|
+
))
|
|
5927
|
+
] }),
|
|
5928
|
+
sharedWorkspaces.length > 0 && /* @__PURE__ */ jsxs47(DropdownMenuGroup, { children: [
|
|
5929
|
+
ownedWorkspaces.length > 0 && /* @__PURE__ */ jsx56(DropdownMenuSeparator2, {}),
|
|
5930
|
+
/* @__PURE__ */ jsx56(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: t("systems.SHARED_WORKSPACES") }),
|
|
5931
|
+
sharedWorkspaces.map((w) => /* @__PURE__ */ jsxs47(
|
|
5932
|
+
DropdownMenuItem4,
|
|
5933
|
+
{
|
|
5934
|
+
className: "flex items-center justify-between",
|
|
5935
|
+
onClick: () => switchWorkspace(w),
|
|
5936
|
+
disabled: isFetchingWorkspace || w.slug !== currentSlug,
|
|
5937
|
+
children: [
|
|
5938
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-2", children: [
|
|
5939
|
+
/* @__PURE__ */ jsx56(
|
|
5940
|
+
WorkspaceLogo,
|
|
5941
|
+
{
|
|
5942
|
+
workspace: w,
|
|
5943
|
+
classNames: { base: "size-7 rounded-[0.2rem]", image: "w-full h-full" }
|
|
5944
|
+
}
|
|
5945
|
+
),
|
|
5946
|
+
/* @__PURE__ */ jsx56("span", { className: "truncate font-medium text-foreground text-sm leading-5 sm:max-w-[140px]", children: w.name ?? w.slug })
|
|
5947
|
+
] }),
|
|
5948
|
+
w.slug === currentSlug && /* @__PURE__ */ jsx56(CheckIcon4, { className: "size-4 text-primary" })
|
|
5949
|
+
]
|
|
5950
|
+
},
|
|
5951
|
+
w.id
|
|
5952
|
+
))
|
|
5953
|
+
] }),
|
|
5954
|
+
/* @__PURE__ */ jsx56(DropdownMenuSeparator2, {}),
|
|
5955
|
+
/* @__PURE__ */ jsxs47(
|
|
5956
|
+
DropdownMenuItem4,
|
|
5957
|
+
{
|
|
5958
|
+
onSelect: () => router.push(
|
|
5959
|
+
`${path.custom.NEW_WORKSPACE}?workspaces=${workspaceList && workspaceList.length > 0}`
|
|
5960
|
+
),
|
|
5961
|
+
children: [
|
|
5962
|
+
/* @__PURE__ */ jsx56(PlusIcon, { className: "size-4" }),
|
|
5963
|
+
/* @__PURE__ */ jsx56("span", { children: t("systems.ADD_WORKSPACE") })
|
|
5964
|
+
]
|
|
5965
|
+
}
|
|
5966
|
+
)
|
|
5967
|
+
]
|
|
5968
|
+
}
|
|
5969
|
+
)
|
|
5970
|
+
] }) });
|
|
5971
|
+
}
|
|
5972
|
+
|
|
5973
|
+
// src/ui/layouts/sidebar.tsx
|
|
5974
|
+
import { Fragment as Fragment19, jsx as jsx57, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
5745
5975
|
function Sidebar({ children }) {
|
|
5746
5976
|
const { isMobile } = useLayout();
|
|
5747
5977
|
if (isMobile) {
|
|
5748
5978
|
return null;
|
|
5749
5979
|
}
|
|
5750
|
-
return /* @__PURE__ */
|
|
5980
|
+
return /* @__PURE__ */ jsxs48("aside", { className: "in-data-[sidebar-open=false]:-start-full fixed start-0 top-(--header-height) bottom-0 flex w-(--sidebar-width) shrink-0 flex-col items-stretch border-border border-e transition-all duration-300", children: [
|
|
5751
5981
|
children,
|
|
5752
|
-
/* @__PURE__ */
|
|
5982
|
+
/* @__PURE__ */ jsx57("div", {})
|
|
5753
5983
|
] });
|
|
5754
5984
|
}
|
|
5755
5985
|
function SidebarHeaderBack({
|
|
5756
5986
|
linkHref = "/",
|
|
5757
5987
|
admin = false
|
|
5758
5988
|
}) {
|
|
5759
|
-
const t =
|
|
5760
|
-
return /* @__PURE__ */
|
|
5989
|
+
const t = useTranslations47();
|
|
5990
|
+
return /* @__PURE__ */ jsx57("div", { className: "flex h-14 shrink-0 items-center gap-2 border-border border-b px-2.5 lg:h-15", children: /* @__PURE__ */ jsx57(BackLink, { Link: Link8, href: linkHref, children: admin ? t("systems.common.actions.back") : t("systems.navigation.settings") }) });
|
|
5991
|
+
}
|
|
5992
|
+
function SidebarHeaderWorkspaces() {
|
|
5993
|
+
return /* @__PURE__ */ jsx57(WorkspaceSwitcher, {});
|
|
5761
5994
|
}
|
|
5762
5995
|
function SidebarContent({ children }) {
|
|
5763
|
-
return /* @__PURE__ */
|
|
5996
|
+
return /* @__PURE__ */ jsx57(ScrollArea, { className: "mt-2 mb-2.5 h-[calc(100vh-5.5rem)] grow lg:mt-4 lg:mb-7.5 lg:h-[calc(100vh-4rem)]", children });
|
|
5764
5997
|
}
|
|
5765
5998
|
function SidebarContentMenu({
|
|
5766
5999
|
menu,
|
|
@@ -5802,7 +6035,7 @@ function SidebarContentMenu({
|
|
|
5802
6035
|
[activePath, normalize]
|
|
5803
6036
|
);
|
|
5804
6037
|
if (type === "toggle") {
|
|
5805
|
-
return /* @__PURE__ */
|
|
6038
|
+
return /* @__PURE__ */ jsx57(
|
|
5806
6039
|
AccordionMenu,
|
|
5807
6040
|
{
|
|
5808
6041
|
type: "single",
|
|
@@ -5816,17 +6049,17 @@ function SidebarContentMenu({
|
|
|
5816
6049
|
subTrigger: "text-xs font-normal text-muted-foreground hover:bg-transparent",
|
|
5817
6050
|
subContent: "ps-0"
|
|
5818
6051
|
},
|
|
5819
|
-
children: menu.map((item, index) => /* @__PURE__ */
|
|
5820
|
-
/* @__PURE__ */
|
|
5821
|
-
/* @__PURE__ */
|
|
5822
|
-
/* @__PURE__ */
|
|
6052
|
+
children: menu.map((item, index) => /* @__PURE__ */ jsxs48(AccordionMenuSub, { value: item.title || "menu", children: [
|
|
6053
|
+
/* @__PURE__ */ jsxs48(AccordionMenuSubTrigger, { value: "menu-trigger", children: [
|
|
6054
|
+
/* @__PURE__ */ jsx57("span", { children: item.title }),
|
|
6055
|
+
/* @__PURE__ */ jsx57(AccordionMenuIndicator, {})
|
|
5823
6056
|
] }),
|
|
5824
|
-
/* @__PURE__ */
|
|
5825
|
-
const content = /* @__PURE__ */
|
|
5826
|
-
child.icon && /* @__PURE__ */
|
|
5827
|
-
/* @__PURE__ */
|
|
5828
|
-
child.badge && /* @__PURE__ */
|
|
5829
|
-
|
|
6057
|
+
/* @__PURE__ */ jsx57(AccordionMenuSubContent, { type: "single", collapsible: true, parentValue: "menu-trigger", children: item.children?.map((child, idx) => {
|
|
6058
|
+
const content = /* @__PURE__ */ jsxs48(Fragment19, { children: [
|
|
6059
|
+
child.icon && /* @__PURE__ */ jsx57(child.icon, {}),
|
|
6060
|
+
/* @__PURE__ */ jsx57("span", { children: child.title }),
|
|
6061
|
+
child.badge && /* @__PURE__ */ jsx57(
|
|
6062
|
+
Badge4,
|
|
5830
6063
|
{
|
|
5831
6064
|
size: "sm",
|
|
5832
6065
|
variant: child.badgeVariant ?? "destructive",
|
|
@@ -5836,8 +6069,8 @@ function SidebarContentMenu({
|
|
|
5836
6069
|
)
|
|
5837
6070
|
] });
|
|
5838
6071
|
if (child.external && child.path) {
|
|
5839
|
-
return /* @__PURE__ */
|
|
5840
|
-
|
|
6072
|
+
return /* @__PURE__ */ jsx57(
|
|
6073
|
+
Link8,
|
|
5841
6074
|
{
|
|
5842
6075
|
href: child.path,
|
|
5843
6076
|
target: "_blank",
|
|
@@ -5848,13 +6081,13 @@ function SidebarContentMenu({
|
|
|
5848
6081
|
child.path || `ext-${idx}`
|
|
5849
6082
|
);
|
|
5850
6083
|
}
|
|
5851
|
-
return /* @__PURE__ */
|
|
6084
|
+
return /* @__PURE__ */ jsx57(AccordionMenuItem, { value: child.path || "#", children: /* @__PURE__ */ jsx57(Link8, { href: child.path || "#", children: content }) }, idx);
|
|
5852
6085
|
}) })
|
|
5853
6086
|
] }, index))
|
|
5854
6087
|
}
|
|
5855
6088
|
);
|
|
5856
6089
|
}
|
|
5857
|
-
return /* @__PURE__ */
|
|
6090
|
+
return /* @__PURE__ */ jsx57(
|
|
5858
6091
|
AccordionMenu,
|
|
5859
6092
|
{
|
|
5860
6093
|
type: "multiple",
|
|
@@ -5867,14 +6100,14 @@ function SidebarContentMenu({
|
|
|
5867
6100
|
group: ""
|
|
5868
6101
|
},
|
|
5869
6102
|
children: menu.map((item, index) => {
|
|
5870
|
-
return /* @__PURE__ */
|
|
5871
|
-
/* @__PURE__ */
|
|
6103
|
+
return /* @__PURE__ */ jsxs48(AccordionMenuGroup, { children: [
|
|
6104
|
+
/* @__PURE__ */ jsx57(AccordionMenuLabel, { children: item.title }),
|
|
5872
6105
|
item.children?.map((child, idx) => {
|
|
5873
|
-
const content = /* @__PURE__ */
|
|
5874
|
-
child.icon && /* @__PURE__ */
|
|
5875
|
-
/* @__PURE__ */
|
|
5876
|
-
child.badge && /* @__PURE__ */
|
|
5877
|
-
|
|
6106
|
+
const content = /* @__PURE__ */ jsxs48(Fragment19, { children: [
|
|
6107
|
+
child.icon && /* @__PURE__ */ jsx57(child.icon, {}),
|
|
6108
|
+
/* @__PURE__ */ jsx57("span", { children: child.title }),
|
|
6109
|
+
child.badge && /* @__PURE__ */ jsx57(
|
|
6110
|
+
Badge4,
|
|
5878
6111
|
{
|
|
5879
6112
|
size: "sm",
|
|
5880
6113
|
variant: child.badgeVariant ?? "destructive",
|
|
@@ -5884,8 +6117,8 @@ function SidebarContentMenu({
|
|
|
5884
6117
|
)
|
|
5885
6118
|
] });
|
|
5886
6119
|
if (child.external && child.path) {
|
|
5887
|
-
return /* @__PURE__ */
|
|
5888
|
-
|
|
6120
|
+
return /* @__PURE__ */ jsx57(
|
|
6121
|
+
Link8,
|
|
5889
6122
|
{
|
|
5890
6123
|
href: child.path,
|
|
5891
6124
|
target: "_blank",
|
|
@@ -5896,7 +6129,7 @@ function SidebarContentMenu({
|
|
|
5896
6129
|
child.path || `ext-${idx}`
|
|
5897
6130
|
);
|
|
5898
6131
|
}
|
|
5899
|
-
return /* @__PURE__ */
|
|
6132
|
+
return /* @__PURE__ */ jsx57(AccordionMenuItem, { value: child.path || "#", children: /* @__PURE__ */ jsx57(Link8, { href: child.path || "#", children: content }) }, idx);
|
|
5900
6133
|
})
|
|
5901
6134
|
] }, index);
|
|
5902
6135
|
})
|
|
@@ -5905,17 +6138,17 @@ function SidebarContentMenu({
|
|
|
5905
6138
|
}
|
|
5906
6139
|
|
|
5907
6140
|
// src/ui/layouts/site-footer.tsx
|
|
5908
|
-
import
|
|
5909
|
-
import { useTranslations as
|
|
6141
|
+
import Link9 from "next/link";
|
|
6142
|
+
import { useTranslations as useTranslations48 } from "next-intl";
|
|
5910
6143
|
import { cn as cn41 } from "pelatform-ui";
|
|
5911
6144
|
import { SiteFooter as UISiteFooter } from "pelatform-ui/components";
|
|
5912
|
-
import { Button as
|
|
5913
|
-
import { jsx as
|
|
6145
|
+
import { Button as Button34 } from "pelatform-ui/default";
|
|
6146
|
+
import { jsx as jsx58, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
5914
6147
|
function SiteFooter({ disableProjectBy = false }) {
|
|
5915
6148
|
const { app } = useConfig();
|
|
5916
|
-
const t =
|
|
5917
|
-
return /* @__PURE__ */
|
|
5918
|
-
/* @__PURE__ */
|
|
6149
|
+
const t = useTranslations48();
|
|
6150
|
+
return /* @__PURE__ */ jsxs49(UISiteFooter, { className: cn41("*:gap-2! *:py-0!", disableProjectBy ? "*:justify-center!" : ""), children: [
|
|
6151
|
+
/* @__PURE__ */ jsxs49("div", { className: "text-balance text-center text-muted-foreground text-sm leading-loose md:text-left", children: [
|
|
5919
6152
|
"\xA9 ",
|
|
5920
6153
|
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
5921
6154
|
" ",
|
|
@@ -5923,11 +6156,11 @@ function SiteFooter({ disableProjectBy = false }) {
|
|
|
5923
6156
|
". ",
|
|
5924
6157
|
t("customs.common.copyright")
|
|
5925
6158
|
] }),
|
|
5926
|
-
!disableProjectBy && /* @__PURE__ */
|
|
5927
|
-
/* @__PURE__ */
|
|
6159
|
+
!disableProjectBy && /* @__PURE__ */ jsx58("div", { className: "flex items-center gap-2.5 text-balance text-sm leading-loose", children: /* @__PURE__ */ jsxs49("div", { className: "inline-flex items-center gap-1", children: [
|
|
6160
|
+
/* @__PURE__ */ jsx58("span", { className: "text-muted-foreground", children: t("customs.common.project_by") }),
|
|
5928
6161
|
" ",
|
|
5929
|
-
/* @__PURE__ */
|
|
5930
|
-
|
|
6162
|
+
/* @__PURE__ */ jsx58(Button34, { mode: "link", underline: "dashed", children: /* @__PURE__ */ jsx58(
|
|
6163
|
+
Link9,
|
|
5931
6164
|
{
|
|
5932
6165
|
href: "https://pelatform.com",
|
|
5933
6166
|
target: "_blank",
|
|
@@ -5941,9 +6174,9 @@ function SiteFooter({ disableProjectBy = false }) {
|
|
|
5941
6174
|
|
|
5942
6175
|
// src/ui/layouts/site-header.tsx
|
|
5943
6176
|
import { useState as useState19 } from "react";
|
|
5944
|
-
import
|
|
5945
|
-
import { usePathname as usePathname4, useRouter as
|
|
5946
|
-
import { useTranslations as
|
|
6177
|
+
import Link10 from "next/link";
|
|
6178
|
+
import { usePathname as usePathname4, useRouter as useRouter17 } from "next/navigation";
|
|
6179
|
+
import { useTranslations as useTranslations49 } from "next-intl";
|
|
5947
6180
|
import {
|
|
5948
6181
|
MainNav,
|
|
5949
6182
|
MobileNav,
|
|
@@ -5951,35 +6184,35 @@ import {
|
|
|
5951
6184
|
ModeSwitcher as ModeSwitcher3,
|
|
5952
6185
|
SiteHeader as UISiteHeader
|
|
5953
6186
|
} from "pelatform-ui/components";
|
|
5954
|
-
import { Button as
|
|
5955
|
-
import { jsx as
|
|
6187
|
+
import { Button as Button35, Separator as Separator2 } from "pelatform-ui/default";
|
|
6188
|
+
import { jsx as jsx59, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
5956
6189
|
function SiteHeader({
|
|
5957
6190
|
menu,
|
|
5958
|
-
logo = /* @__PURE__ */
|
|
6191
|
+
logo = /* @__PURE__ */ jsx59(LogoWithHref, { href: "/home" })
|
|
5959
6192
|
}) {
|
|
5960
6193
|
const { path } = useConfig();
|
|
5961
6194
|
const pathname = usePathname4();
|
|
5962
|
-
const router =
|
|
5963
|
-
const t =
|
|
6195
|
+
const router = useRouter17();
|
|
6196
|
+
const t = useTranslations49();
|
|
5964
6197
|
const { isPending, session, user } = useSession();
|
|
5965
6198
|
const [, setMobileNavOpen] = useState19(false);
|
|
5966
6199
|
const isAuthenticated = !isPending && session && user;
|
|
5967
|
-
return /* @__PURE__ */
|
|
5968
|
-
/* @__PURE__ */
|
|
6200
|
+
return /* @__PURE__ */ jsxs50(UISiteHeader, { className: "backdrop-blur-none supports-backdrop-filter:bg-background", children: [
|
|
6201
|
+
/* @__PURE__ */ jsxs50("div", { className: "flex items-center gap-4.5", children: [
|
|
5969
6202
|
logo,
|
|
5970
|
-
/* @__PURE__ */
|
|
6203
|
+
/* @__PURE__ */ jsx59(MainNav, { Link: Link10, pathname, items: menu })
|
|
5971
6204
|
] }),
|
|
5972
|
-
/* @__PURE__ */
|
|
5973
|
-
/* @__PURE__ */
|
|
5974
|
-
/* @__PURE__ */
|
|
5975
|
-
/* @__PURE__ */
|
|
5976
|
-
/* @__PURE__ */
|
|
6205
|
+
/* @__PURE__ */ jsx59("div", { className: "flex items-center justify-end gap-3", children: /* @__PURE__ */ jsxs50("nav", { className: "flex items-center gap-0 md:gap-1", children: [
|
|
6206
|
+
/* @__PURE__ */ jsx59(ModeSwitcher3, {}),
|
|
6207
|
+
/* @__PURE__ */ jsx59(LanguageSwitcher, {}),
|
|
6208
|
+
/* @__PURE__ */ jsx59(Separator2, { orientation: "vertical", className: "mx-3 h-5 max-lg:hidden" }),
|
|
6209
|
+
/* @__PURE__ */ jsx59(MobileNav, { children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-col space-y-3", children: [
|
|
5977
6210
|
menu?.map(
|
|
5978
|
-
(item, navIndex) => item.href || item.children ? /* @__PURE__ */
|
|
6211
|
+
(item, navIndex) => item.href || item.children ? /* @__PURE__ */ jsx59(
|
|
5979
6212
|
MobileNavItemRenderer,
|
|
5980
6213
|
{
|
|
5981
6214
|
item,
|
|
5982
|
-
Link:
|
|
6215
|
+
Link: Link10,
|
|
5983
6216
|
pathname,
|
|
5984
6217
|
level: 1,
|
|
5985
6218
|
onOpenChange: setMobileNavOpen
|
|
@@ -5987,8 +6220,8 @@ function SiteHeader({
|
|
|
5987
6220
|
`nav-${navIndex}-${item.href}`
|
|
5988
6221
|
) : null
|
|
5989
6222
|
),
|
|
5990
|
-
/* @__PURE__ */
|
|
5991
|
-
|
|
6223
|
+
/* @__PURE__ */ jsx59("div", { className: "border-t pt-3", children: isAuthenticated ? /* @__PURE__ */ jsx59(
|
|
6224
|
+
Button35,
|
|
5992
6225
|
{
|
|
5993
6226
|
variant: "outline",
|
|
5994
6227
|
size: "sm",
|
|
@@ -5996,36 +6229,36 @@ function SiteHeader({
|
|
|
5996
6229
|
onClick: () => router.push(path.auth.SIGN_OUT),
|
|
5997
6230
|
children: t("systems.navigation.logout")
|
|
5998
6231
|
}
|
|
5999
|
-
) : /* @__PURE__ */
|
|
6232
|
+
) : /* @__PURE__ */ jsx59(Button35, { variant: "secondary", size: "sm", className: "w-full", children: /* @__PURE__ */ jsx59(Link10, { href: path.auth.SIGN_IN, children: t("systems.navigation.login") }) }) })
|
|
6000
6233
|
] }) }),
|
|
6001
|
-
isAuthenticated ? /* @__PURE__ */
|
|
6234
|
+
isAuthenticated ? /* @__PURE__ */ jsx59(UserMenu, { hiddenSwitcher: true }) : /* @__PURE__ */ jsx59(Button35, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx59(Link10, { href: path.auth.SIGN_IN, children: t("systems.navigation.login") }) })
|
|
6002
6235
|
] }) })
|
|
6003
6236
|
] });
|
|
6004
6237
|
}
|
|
6005
6238
|
function SiteHeaderSecondary({
|
|
6006
6239
|
menu,
|
|
6007
|
-
logo = /* @__PURE__ */
|
|
6240
|
+
logo = /* @__PURE__ */ jsx59(LogoWithHref, { href: "/home" }),
|
|
6008
6241
|
loginLink
|
|
6009
6242
|
}) {
|
|
6010
6243
|
const pathname = usePathname4();
|
|
6011
|
-
const t =
|
|
6244
|
+
const t = useTranslations49();
|
|
6012
6245
|
const [, setMobileNavOpen] = useState19(false);
|
|
6013
|
-
return /* @__PURE__ */
|
|
6014
|
-
/* @__PURE__ */
|
|
6246
|
+
return /* @__PURE__ */ jsxs50(UISiteHeader, { className: "backdrop-blur-none supports-backdrop-filter:bg-background", children: [
|
|
6247
|
+
/* @__PURE__ */ jsxs50("div", { className: "flex items-center gap-4.5", children: [
|
|
6015
6248
|
logo,
|
|
6016
|
-
/* @__PURE__ */
|
|
6249
|
+
/* @__PURE__ */ jsx59(MainNav, { Link: Link10, pathname, items: menu })
|
|
6017
6250
|
] }),
|
|
6018
|
-
/* @__PURE__ */
|
|
6019
|
-
/* @__PURE__ */
|
|
6020
|
-
/* @__PURE__ */
|
|
6021
|
-
/* @__PURE__ */
|
|
6022
|
-
/* @__PURE__ */
|
|
6251
|
+
/* @__PURE__ */ jsx59("div", { className: "flex items-center justify-end gap-3", children: /* @__PURE__ */ jsxs50("nav", { className: "flex items-center gap-0 md:gap-1", children: [
|
|
6252
|
+
/* @__PURE__ */ jsx59(ModeSwitcher3, {}),
|
|
6253
|
+
/* @__PURE__ */ jsx59(LanguageSwitcher, {}),
|
|
6254
|
+
/* @__PURE__ */ jsx59(Separator2, { orientation: "vertical", className: "mx-3 h-5 max-lg:hidden" }),
|
|
6255
|
+
/* @__PURE__ */ jsx59(MobileNav, { children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-col space-y-3", children: [
|
|
6023
6256
|
menu?.map(
|
|
6024
|
-
(item, navIndex) => item.href || item.children ? /* @__PURE__ */
|
|
6257
|
+
(item, navIndex) => item.href || item.children ? /* @__PURE__ */ jsx59(
|
|
6025
6258
|
MobileNavItemRenderer,
|
|
6026
6259
|
{
|
|
6027
6260
|
item,
|
|
6028
|
-
Link:
|
|
6261
|
+
Link: Link10,
|
|
6029
6262
|
pathname,
|
|
6030
6263
|
level: 1,
|
|
6031
6264
|
onOpenChange: setMobileNavOpen
|
|
@@ -6033,9 +6266,9 @@ function SiteHeaderSecondary({
|
|
|
6033
6266
|
`nav-${navIndex}-${item.href}`
|
|
6034
6267
|
) : null
|
|
6035
6268
|
),
|
|
6036
|
-
loginLink && /* @__PURE__ */
|
|
6269
|
+
loginLink && /* @__PURE__ */ jsx59("div", { className: "border-t pt-3", children: /* @__PURE__ */ jsx59(Button35, { variant: "secondary", size: "sm", className: "w-full", children: /* @__PURE__ */ jsx59(Link10, { href: loginLink, children: t("systems.navigation.login") }) }) })
|
|
6037
6270
|
] }) }),
|
|
6038
|
-
loginLink && /* @__PURE__ */
|
|
6271
|
+
loginLink && /* @__PURE__ */ jsx59(Button35, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx59(Link10, { href: loginLink, children: t("systems.navigation.login") }) })
|
|
6039
6272
|
] }) })
|
|
6040
6273
|
] });
|
|
6041
6274
|
}
|
|
@@ -6044,7 +6277,7 @@ function SiteHeaderSecondary({
|
|
|
6044
6277
|
import { useEffect as useEffect16, useState as useState20 } from "react";
|
|
6045
6278
|
import { cn as cn42 } from "pelatform-ui";
|
|
6046
6279
|
import { useIsMobile } from "pelatform-ui/hooks";
|
|
6047
|
-
import { jsx as
|
|
6280
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
6048
6281
|
var SIDEBAR_WIDTH = "240px";
|
|
6049
6282
|
var HEADER_HEIGHT = "54px";
|
|
6050
6283
|
var SIDEBAR_WIDTH_MOBILE = "240px";
|
|
@@ -6054,7 +6287,7 @@ function LayoutProvider({
|
|
|
6054
6287
|
style: customStyle,
|
|
6055
6288
|
bodyClassName = "",
|
|
6056
6289
|
className = "",
|
|
6057
|
-
logoHeader = /* @__PURE__ */
|
|
6290
|
+
logoHeader = /* @__PURE__ */ jsx60(LogoWithHref, {})
|
|
6058
6291
|
}) {
|
|
6059
6292
|
const isMobile = useIsMobile();
|
|
6060
6293
|
const [isSidebarOpen, setIsSidebarOpen] = useState20(true);
|
|
@@ -6079,7 +6312,7 @@ function LayoutProvider({
|
|
|
6079
6312
|
};
|
|
6080
6313
|
}
|
|
6081
6314
|
}, [bodyClassName]);
|
|
6082
|
-
return /* @__PURE__ */
|
|
6315
|
+
return /* @__PURE__ */ jsx60(
|
|
6083
6316
|
LayoutContext.Provider,
|
|
6084
6317
|
{
|
|
6085
6318
|
value: {
|
|
@@ -6090,7 +6323,7 @@ function LayoutProvider({
|
|
|
6090
6323
|
sidebarToggle,
|
|
6091
6324
|
logoHeader
|
|
6092
6325
|
},
|
|
6093
|
-
children: /* @__PURE__ */
|
|
6326
|
+
children: /* @__PURE__ */ jsx60(
|
|
6094
6327
|
"div",
|
|
6095
6328
|
{
|
|
6096
6329
|
"data-slot": "layout-wrapper",
|
|
@@ -6105,53 +6338,52 @@ function LayoutProvider({
|
|
|
6105
6338
|
}
|
|
6106
6339
|
|
|
6107
6340
|
// src/ui/layouts/wrapper.tsx
|
|
6108
|
-
import { Fragment as Fragment20, jsx as
|
|
6341
|
+
import { Fragment as Fragment20, jsx as jsx61, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
6109
6342
|
function LayoutWrapper({
|
|
6110
6343
|
children,
|
|
6111
6344
|
sidebarHeader,
|
|
6112
6345
|
sidebarMenu,
|
|
6113
6346
|
logoHeader
|
|
6114
6347
|
}) {
|
|
6115
|
-
const sidebarContent = /* @__PURE__ */
|
|
6348
|
+
const sidebarContent = /* @__PURE__ */ jsxs51(Fragment20, { children: [
|
|
6116
6349
|
sidebarHeader,
|
|
6117
|
-
/* @__PURE__ */
|
|
6350
|
+
/* @__PURE__ */ jsx61(SidebarContent, { children: sidebarMenu })
|
|
6118
6351
|
] });
|
|
6119
|
-
return /* @__PURE__ */
|
|
6120
|
-
/* @__PURE__ */
|
|
6121
|
-
/* @__PURE__ */
|
|
6122
|
-
/* @__PURE__ */
|
|
6352
|
+
return /* @__PURE__ */ jsxs51(LayoutProvider, { logoHeader, children: [
|
|
6353
|
+
/* @__PURE__ */ jsxs51(Header, { children: [
|
|
6354
|
+
/* @__PURE__ */ jsx61(HeaderLeft, {}),
|
|
6355
|
+
/* @__PURE__ */ jsx61(HeaderRight, { sidebar: /* @__PURE__ */ jsx61(HeaderSidebarMobile, { children: sidebarContent }) })
|
|
6123
6356
|
] }),
|
|
6124
|
-
/* @__PURE__ */
|
|
6125
|
-
/* @__PURE__ */
|
|
6126
|
-
/* @__PURE__ */
|
|
6357
|
+
/* @__PURE__ */ jsxs51("div", { className: "flex grow pt-(--header-height-mobile) lg:pt-(--header-height)", children: [
|
|
6358
|
+
/* @__PURE__ */ jsx61(Sidebar, { children: sidebarContent }),
|
|
6359
|
+
/* @__PURE__ */ jsx61("main", { className: "grow transition-all duration-300 lg:in-data-[sidebar-open=false]:ps-0 lg:ps-(--sidebar-width)", children })
|
|
6127
6360
|
] })
|
|
6128
6361
|
] });
|
|
6129
6362
|
}
|
|
6130
6363
|
|
|
6131
6364
|
// src/ui/pages/accept-invitation.tsx
|
|
6132
6365
|
import { useEffect as useEffect17, useState as useState21 } from "react";
|
|
6133
|
-
import { useRouter as
|
|
6134
|
-
import { CheckIcon as
|
|
6135
|
-
import { useTranslations as
|
|
6366
|
+
import { useRouter as useRouter18, useSearchParams as useSearchParams6 } from "next/navigation";
|
|
6367
|
+
import { CheckIcon as CheckIcon5, XIcon } from "lucide-react";
|
|
6368
|
+
import { useTranslations as useTranslations50 } from "next-intl";
|
|
6136
6369
|
import { cn as cn43 } from "pelatform-ui";
|
|
6137
|
-
import { AlertToast as
|
|
6138
|
-
import { Button as
|
|
6139
|
-
import { jsx as
|
|
6370
|
+
import { AlertToast as AlertToast25 } from "pelatform-ui/components";
|
|
6371
|
+
import { Button as Button36, Card as Card11, CardContent as CardContent3, CardHeader as CardHeader2, Skeleton as Skeleton11, Spinner as Spinner20 } from "pelatform-ui/default";
|
|
6372
|
+
import { jsx as jsx62, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
6140
6373
|
function AcceptInvitation({
|
|
6141
6374
|
className,
|
|
6142
6375
|
classNames,
|
|
6143
|
-
redirectTo
|
|
6376
|
+
redirectTo = "/"
|
|
6144
6377
|
}) {
|
|
6145
|
-
const router =
|
|
6378
|
+
const router = useRouter18();
|
|
6146
6379
|
const searchParams = useSearchParams6();
|
|
6147
|
-
const t =
|
|
6380
|
+
const t = useTranslations50();
|
|
6148
6381
|
const { data: sessionData } = useSession();
|
|
6149
|
-
const { redirectTo } = useOnSuccessTransition(redirectToProp);
|
|
6150
6382
|
const [invitationId, setInvitationId] = useState21(null);
|
|
6151
6383
|
useEffect17(() => {
|
|
6152
|
-
const invitationIdParam = searchParams.get("
|
|
6384
|
+
const invitationIdParam = searchParams.get("id");
|
|
6153
6385
|
if (!invitationIdParam) {
|
|
6154
|
-
|
|
6386
|
+
AlertToast25({
|
|
6155
6387
|
message: t("systems.INVITATION_NOT_FOUND"),
|
|
6156
6388
|
icon: "destructive"
|
|
6157
6389
|
});
|
|
@@ -6161,9 +6393,9 @@ function AcceptInvitation({
|
|
|
6161
6393
|
setInvitationId(invitationIdParam);
|
|
6162
6394
|
}, [router, redirectTo, searchParams.get, t]);
|
|
6163
6395
|
if (!sessionData || !invitationId) {
|
|
6164
|
-
return /* @__PURE__ */
|
|
6396
|
+
return /* @__PURE__ */ jsx62(AcceptInvitationSkeleton, { className, classNames });
|
|
6165
6397
|
}
|
|
6166
|
-
return /* @__PURE__ */
|
|
6398
|
+
return /* @__PURE__ */ jsx62(
|
|
6167
6399
|
AcceptInvitationContent,
|
|
6168
6400
|
{
|
|
6169
6401
|
className,
|
|
@@ -6180,8 +6412,8 @@ function AcceptInvitationContent({
|
|
|
6180
6412
|
redirectTo
|
|
6181
6413
|
}) {
|
|
6182
6414
|
const { authClient } = useConfig();
|
|
6183
|
-
const router =
|
|
6184
|
-
const t =
|
|
6415
|
+
const router = useRouter18();
|
|
6416
|
+
const t = useTranslations50();
|
|
6185
6417
|
const { data: invitation, isPending } = useInvitation({
|
|
6186
6418
|
query: {
|
|
6187
6419
|
id: invitationId
|
|
@@ -6193,7 +6425,7 @@ function AcceptInvitationContent({
|
|
|
6193
6425
|
useEffect17(() => {
|
|
6194
6426
|
if (isPending || !invitationId) return;
|
|
6195
6427
|
if (!invitation) {
|
|
6196
|
-
|
|
6428
|
+
AlertToast25({
|
|
6197
6429
|
message: t("systems.INVITATION_NOT_FOUND"),
|
|
6198
6430
|
icon: "destructive"
|
|
6199
6431
|
});
|
|
@@ -6201,7 +6433,7 @@ function AcceptInvitationContent({
|
|
|
6201
6433
|
return;
|
|
6202
6434
|
}
|
|
6203
6435
|
if (invitation.status !== "pending" || new Date(invitation.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
6204
|
-
|
|
6436
|
+
AlertToast25({
|
|
6205
6437
|
message: new Date(invitation.expiresAt) < /* @__PURE__ */ new Date() ? t("systems.INVITATION_EXPIRED") : t("systems.INVITATION_NOT_FOUND"),
|
|
6206
6438
|
icon: "destructive"
|
|
6207
6439
|
});
|
|
@@ -6215,12 +6447,12 @@ function AcceptInvitationContent({
|
|
|
6215
6447
|
invitationId,
|
|
6216
6448
|
fetchOptions: { throw: true }
|
|
6217
6449
|
});
|
|
6218
|
-
|
|
6450
|
+
AlertToast25({
|
|
6219
6451
|
message: t("systems.INVITATION_ACCEPTED")
|
|
6220
6452
|
});
|
|
6221
6453
|
router.replace(redirectTo);
|
|
6222
6454
|
} catch (error) {
|
|
6223
|
-
|
|
6455
|
+
AlertToast25({
|
|
6224
6456
|
message: getTranslations({ error, t }),
|
|
6225
6457
|
icon: "destructive"
|
|
6226
6458
|
});
|
|
@@ -6234,12 +6466,12 @@ function AcceptInvitationContent({
|
|
|
6234
6466
|
invitationId,
|
|
6235
6467
|
fetchOptions: { throw: true }
|
|
6236
6468
|
});
|
|
6237
|
-
|
|
6469
|
+
AlertToast25({
|
|
6238
6470
|
message: t("systems.INVITATION_REJECTED")
|
|
6239
6471
|
});
|
|
6240
6472
|
router.replace(redirectTo);
|
|
6241
6473
|
} catch (error) {
|
|
6242
|
-
|
|
6474
|
+
AlertToast25({
|
|
6243
6475
|
message: getTranslations({ error, t }),
|
|
6244
6476
|
icon: "destructive"
|
|
6245
6477
|
});
|
|
@@ -6247,19 +6479,19 @@ function AcceptInvitationContent({
|
|
|
6247
6479
|
}
|
|
6248
6480
|
};
|
|
6249
6481
|
if (!invitation) {
|
|
6250
|
-
return /* @__PURE__ */
|
|
6482
|
+
return /* @__PURE__ */ jsx62(AcceptInvitationSkeleton, { className, classNames });
|
|
6251
6483
|
}
|
|
6252
|
-
return /* @__PURE__ */
|
|
6253
|
-
/* @__PURE__ */
|
|
6484
|
+
return /* @__PURE__ */ jsxs52(Card11, { className: cn43("w-full max-w-md overflow-hidden", className, classNames?.base), children: [
|
|
6485
|
+
/* @__PURE__ */ jsx62(CardHeader2, { className: "py-4", children: /* @__PURE__ */ jsx62(
|
|
6254
6486
|
CardHeaderComponent,
|
|
6255
6487
|
{
|
|
6256
6488
|
title: t("systems.ACCEPT_INVITATION"),
|
|
6257
6489
|
description: t("systems.ACCEPT_INVITATION_DESCRIPTION")
|
|
6258
6490
|
}
|
|
6259
6491
|
) }),
|
|
6260
|
-
/* @__PURE__ */
|
|
6261
|
-
/* @__PURE__ */
|
|
6262
|
-
/* @__PURE__ */
|
|
6492
|
+
/* @__PURE__ */ jsxs52(CardContent3, { className: cn43("flex flex-col gap-6 truncate", classNames?.content), children: [
|
|
6493
|
+
/* @__PURE__ */ jsxs52(Card11, { className: cn43("flex-row items-center p-4"), children: [
|
|
6494
|
+
/* @__PURE__ */ jsx62(
|
|
6263
6495
|
WorkspaceView,
|
|
6264
6496
|
{
|
|
6265
6497
|
workspace: {
|
|
@@ -6271,30 +6503,30 @@ function AcceptInvitationContent({
|
|
|
6271
6503
|
}
|
|
6272
6504
|
}
|
|
6273
6505
|
),
|
|
6274
|
-
/* @__PURE__ */
|
|
6506
|
+
/* @__PURE__ */ jsx62("p", { className: "ms-auto font-semibold text-muted-foreground text-sm", children: t(`systems.${invitation?.role.toUpperCase()}`) || invitation?.role })
|
|
6275
6507
|
] }),
|
|
6276
|
-
/* @__PURE__ */
|
|
6277
|
-
/* @__PURE__ */
|
|
6278
|
-
|
|
6508
|
+
/* @__PURE__ */ jsxs52("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
6509
|
+
/* @__PURE__ */ jsxs52(
|
|
6510
|
+
Button36,
|
|
6279
6511
|
{
|
|
6280
6512
|
variant: "destructive",
|
|
6281
6513
|
className: cn43(classNames?.button, classNames?.destructiveButton),
|
|
6282
6514
|
onClick: rejectInvitation,
|
|
6283
6515
|
disabled: isProcessing,
|
|
6284
6516
|
children: [
|
|
6285
|
-
isRejecting ? /* @__PURE__ */
|
|
6517
|
+
isRejecting ? /* @__PURE__ */ jsx62(Spinner20, {}) : /* @__PURE__ */ jsx62(XIcon, {}),
|
|
6286
6518
|
t("systems.REJECT")
|
|
6287
6519
|
]
|
|
6288
6520
|
}
|
|
6289
6521
|
),
|
|
6290
|
-
/* @__PURE__ */
|
|
6291
|
-
|
|
6522
|
+
/* @__PURE__ */ jsxs52(
|
|
6523
|
+
Button36,
|
|
6292
6524
|
{
|
|
6293
6525
|
className: cn43(classNames?.button, classNames?.primaryButton),
|
|
6294
6526
|
onClick: acceptInvitation,
|
|
6295
6527
|
disabled: isProcessing,
|
|
6296
6528
|
children: [
|
|
6297
|
-
isAccepting ? /* @__PURE__ */
|
|
6529
|
+
isAccepting ? /* @__PURE__ */ jsx62(Spinner20, {}) : /* @__PURE__ */ jsx62(CheckIcon5, {}),
|
|
6298
6530
|
t("systems.ACCEPT")
|
|
6299
6531
|
]
|
|
6300
6532
|
}
|
|
@@ -6304,9 +6536,9 @@ function AcceptInvitationContent({
|
|
|
6304
6536
|
] });
|
|
6305
6537
|
}
|
|
6306
6538
|
function AcceptInvitationSkeleton({ className, classNames }) {
|
|
6307
|
-
const t =
|
|
6308
|
-
return /* @__PURE__ */
|
|
6309
|
-
/* @__PURE__ */
|
|
6539
|
+
const t = useTranslations50();
|
|
6540
|
+
return /* @__PURE__ */ jsxs52(Card11, { className: cn43("w-full max-w-md overflow-hidden", className, classNames?.base), children: [
|
|
6541
|
+
/* @__PURE__ */ jsx62(CardHeader2, { className: "py-4", children: /* @__PURE__ */ jsx62(
|
|
6310
6542
|
CardHeaderComponent,
|
|
6311
6543
|
{
|
|
6312
6544
|
className: "w-full",
|
|
@@ -6315,14 +6547,401 @@ function AcceptInvitationSkeleton({ className, classNames }) {
|
|
|
6315
6547
|
isPending: true
|
|
6316
6548
|
}
|
|
6317
6549
|
) }),
|
|
6318
|
-
/* @__PURE__ */
|
|
6319
|
-
/* @__PURE__ */
|
|
6320
|
-
/* @__PURE__ */
|
|
6321
|
-
/* @__PURE__ */
|
|
6550
|
+
/* @__PURE__ */ jsxs52(CardContent3, { className: cn43("flex flex-col gap-6 truncate", classNames?.content), children: [
|
|
6551
|
+
/* @__PURE__ */ jsxs52(Card11, { className: cn43("flex-row items-center p-4"), children: [
|
|
6552
|
+
/* @__PURE__ */ jsx62(WorkspaceView, { isPending: true }),
|
|
6553
|
+
/* @__PURE__ */ jsx62(Skeleton11, { className: "ms-auto mt-0.5 h-4 w-full max-w-14 shrink-2" })
|
|
6322
6554
|
] }),
|
|
6323
|
-
/* @__PURE__ */
|
|
6324
|
-
/* @__PURE__ */
|
|
6325
|
-
/* @__PURE__ */
|
|
6555
|
+
/* @__PURE__ */ jsxs52("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
6556
|
+
/* @__PURE__ */ jsx62(Skeleton11, { className: "h-9 w-full" }),
|
|
6557
|
+
/* @__PURE__ */ jsx62(Skeleton11, { className: "h-9 w-full" })
|
|
6558
|
+
] })
|
|
6559
|
+
] })
|
|
6560
|
+
] });
|
|
6561
|
+
}
|
|
6562
|
+
|
|
6563
|
+
// src/ui/pages/new-workspace.tsx
|
|
6564
|
+
import Link11 from "next/link";
|
|
6565
|
+
import { useRouter as useRouter19, useSearchParams as useSearchParams7 } from "next/navigation";
|
|
6566
|
+
import { zodResolver as zodResolver15 } from "@hookform/resolvers/zod";
|
|
6567
|
+
import { useTranslations as useTranslations51 } from "next-intl";
|
|
6568
|
+
import { useForm as useForm16 } from "react-hook-form";
|
|
6569
|
+
import slugify from "slugify";
|
|
6570
|
+
import { z as z15 } from "zod";
|
|
6571
|
+
import { cn as cn44 } from "pelatform-ui";
|
|
6572
|
+
import { AlertToast as AlertToast26 } from "pelatform-ui/components";
|
|
6573
|
+
import {
|
|
6574
|
+
Button as Button37,
|
|
6575
|
+
buttonVariants,
|
|
6576
|
+
Card as Card12,
|
|
6577
|
+
CardContent as CardContent4,
|
|
6578
|
+
CardHeader as CardHeader3,
|
|
6579
|
+
Form as Form16,
|
|
6580
|
+
FormControl as FormControl15,
|
|
6581
|
+
FormField as FormField15,
|
|
6582
|
+
FormItem as FormItem15,
|
|
6583
|
+
FormLabel as FormLabel14,
|
|
6584
|
+
FormMessage as FormMessage15,
|
|
6585
|
+
Input as Input12,
|
|
6586
|
+
Spinner as Spinner21
|
|
6587
|
+
} from "pelatform-ui/default";
|
|
6588
|
+
import { jsx as jsx63, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
6589
|
+
function NewWorkspace({ className, classNames }) {
|
|
6590
|
+
const searchParams = useSearchParams7();
|
|
6591
|
+
const t = useTranslations51();
|
|
6592
|
+
const hasWorkspaces = searchParams.get("workspaces") === "true";
|
|
6593
|
+
return /* @__PURE__ */ jsxs53(Card12, { className: cn44("w-full max-w-md overflow-hidden", className, classNames?.base), children: [
|
|
6594
|
+
/* @__PURE__ */ jsx63(CardHeader3, { className: "py-4", children: /* @__PURE__ */ jsx63(
|
|
6595
|
+
CardHeaderComponent,
|
|
6596
|
+
{
|
|
6597
|
+
className: "w-full text-center",
|
|
6598
|
+
title: t("systems.NEW_ORGANIZATION_TITLE"),
|
|
6599
|
+
description: t(
|
|
6600
|
+
hasWorkspaces ? "systems.NEW_ORGANIZATION_DESCRIPTION_HAS" : "systems.NEW_ORGANIZATION_DESCRIPTION"
|
|
6601
|
+
)
|
|
6602
|
+
}
|
|
6603
|
+
) }),
|
|
6604
|
+
/* @__PURE__ */ jsx63(CardContent4, { className: cn44("flex flex-col gap-6 truncate", classNames?.content), children: /* @__PURE__ */ jsx63(NewWorkspaceForm, { hasWorkspaces }) })
|
|
6605
|
+
] });
|
|
6606
|
+
}
|
|
6607
|
+
function NewWorkspaceForm({ hasWorkspaces = false }) {
|
|
6608
|
+
const { authClient, path } = useConfig();
|
|
6609
|
+
const router = useRouter19();
|
|
6610
|
+
const t = useTranslations51();
|
|
6611
|
+
const RESERVED_SLUGS = [
|
|
6612
|
+
// Main routes
|
|
6613
|
+
path.main.ERROR.replace("/", ""),
|
|
6614
|
+
path.main.HOME.replace("/", ""),
|
|
6615
|
+
path.main.FEATURES.replace("/", ""),
|
|
6616
|
+
path.main.PRICING.replace("/", ""),
|
|
6617
|
+
path.main.TERMS.replace("/", ""),
|
|
6618
|
+
path.main.PRIVACY.replace("/", ""),
|
|
6619
|
+
// Auth routes
|
|
6620
|
+
path.auth.EMAIL_OTP.replace("/", ""),
|
|
6621
|
+
path.auth.FORGOT_PASSWORD.replace("/", ""),
|
|
6622
|
+
path.auth.MAGIC_LINK.replace("/", ""),
|
|
6623
|
+
path.auth.RECOVER_ACCOUNT.replace("/", ""),
|
|
6624
|
+
path.auth.RESET_PASSWORD.replace("/", ""),
|
|
6625
|
+
path.auth.SIGN_IN.replace("/", ""),
|
|
6626
|
+
path.auth.SIGN_OUT.replace("/", ""),
|
|
6627
|
+
path.auth.SIGN_UP.replace("/", ""),
|
|
6628
|
+
path.auth.TWO_FACTOR.replace("/", ""),
|
|
6629
|
+
// System routes
|
|
6630
|
+
"new",
|
|
6631
|
+
"accept",
|
|
6632
|
+
"invitation",
|
|
6633
|
+
"join",
|
|
6634
|
+
"verify",
|
|
6635
|
+
"api",
|
|
6636
|
+
"account",
|
|
6637
|
+
"accounts",
|
|
6638
|
+
"billing",
|
|
6639
|
+
"billings",
|
|
6640
|
+
"user",
|
|
6641
|
+
"users",
|
|
6642
|
+
"onboarding",
|
|
6643
|
+
"organization",
|
|
6644
|
+
"organizations",
|
|
6645
|
+
"workspace",
|
|
6646
|
+
"workspaces",
|
|
6647
|
+
"setting",
|
|
6648
|
+
"settings",
|
|
6649
|
+
"apikey",
|
|
6650
|
+
"apikeys",
|
|
6651
|
+
"member",
|
|
6652
|
+
"members",
|
|
6653
|
+
"people",
|
|
6654
|
+
"peoples",
|
|
6655
|
+
// Next.js internals
|
|
6656
|
+
"_next",
|
|
6657
|
+
"static",
|
|
6658
|
+
"favicon",
|
|
6659
|
+
"robots",
|
|
6660
|
+
"sitemap",
|
|
6661
|
+
// Future-proofing common patterns
|
|
6662
|
+
"admin",
|
|
6663
|
+
"dashboard",
|
|
6664
|
+
"app",
|
|
6665
|
+
"www",
|
|
6666
|
+
"home",
|
|
6667
|
+
"blog",
|
|
6668
|
+
"docs",
|
|
6669
|
+
"help",
|
|
6670
|
+
"support",
|
|
6671
|
+
"about",
|
|
6672
|
+
"contact",
|
|
6673
|
+
"features",
|
|
6674
|
+
"pricing",
|
|
6675
|
+
"terms",
|
|
6676
|
+
"privacy"
|
|
6677
|
+
];
|
|
6678
|
+
const formSchema = z15.object({
|
|
6679
|
+
name: z15.string().min(1, {
|
|
6680
|
+
error: `${t("systems.ORGANIZATION_NAME")} ${t("systems.IS_REQUIRED")}`
|
|
6681
|
+
}),
|
|
6682
|
+
slug: z15.string().min(1, {
|
|
6683
|
+
error: `${t("systems.ORGANIZATION_SLUG")} ${t("systems.IS_REQUIRED")}`
|
|
6684
|
+
}).regex(/^[a-z0-9]+([a-z0-9-]*[a-z0-9])?$/, {
|
|
6685
|
+
error: `${t("systems.ORGANIZATION_SLUG")} ${t("systems.IS_INVALID")}`
|
|
6686
|
+
}).refine((slug) => !RESERVED_SLUGS.includes(slug), {
|
|
6687
|
+
error: `${t("systems.ORGANIZATION_SLUG")} ${t("systems.IS_INVALID")}`
|
|
6688
|
+
})
|
|
6689
|
+
});
|
|
6690
|
+
const form = useForm16({
|
|
6691
|
+
resolver: zodResolver15(formSchema),
|
|
6692
|
+
defaultValues: {
|
|
6693
|
+
name: "",
|
|
6694
|
+
slug: ""
|
|
6695
|
+
}
|
|
6696
|
+
});
|
|
6697
|
+
const watchedName = form.watch("name");
|
|
6698
|
+
const watchedSlug = form.watch("slug");
|
|
6699
|
+
const isSubmitting = form.formState.isSubmitting;
|
|
6700
|
+
const disableSubmit = isSubmitting || !form.formState.isValid || !watchedName || !watchedSlug;
|
|
6701
|
+
async function onSubmit({ name, slug }) {
|
|
6702
|
+
const { error } = await authClient.organization.checkSlug({
|
|
6703
|
+
slug
|
|
6704
|
+
});
|
|
6705
|
+
if (error) {
|
|
6706
|
+
AlertToast26({
|
|
6707
|
+
message: getTranslations({ error, t }),
|
|
6708
|
+
icon: "destructive"
|
|
6709
|
+
});
|
|
6710
|
+
console.log("check slug error", error);
|
|
6711
|
+
return;
|
|
6712
|
+
}
|
|
6713
|
+
try {
|
|
6714
|
+
const organization = await authClient.organization.create({
|
|
6715
|
+
name,
|
|
6716
|
+
slug,
|
|
6717
|
+
logo: `https://api.dicebear.com/9.x/glass/svg?seed=${slug}`,
|
|
6718
|
+
fetchOptions: { throw: true }
|
|
6719
|
+
});
|
|
6720
|
+
if (organization) {
|
|
6721
|
+
console.log("setting active organization", organization.id);
|
|
6722
|
+
await authClient.organization.setActive({
|
|
6723
|
+
organizationId: organization.id
|
|
6724
|
+
});
|
|
6725
|
+
console.log("active organization set", organization.id);
|
|
6726
|
+
router.push(`/${organization.slug}`);
|
|
6727
|
+
AlertToast26({
|
|
6728
|
+
message: t("systems.CREATE_ORGANIZATION_SUCCESS")
|
|
6729
|
+
});
|
|
6730
|
+
}
|
|
6731
|
+
} catch (error2) {
|
|
6732
|
+
AlertToast26({
|
|
6733
|
+
message: getTranslations({ error: error2, t }),
|
|
6734
|
+
icon: "destructive"
|
|
6735
|
+
});
|
|
6736
|
+
}
|
|
6737
|
+
}
|
|
6738
|
+
const handleSlugify = (slug) => {
|
|
6739
|
+
return slugify(slug, { lower: true, strict: true, remove: /[*+~.()'"!:@]/g });
|
|
6740
|
+
};
|
|
6741
|
+
return /* @__PURE__ */ jsx63(Form16, { ...form, children: /* @__PURE__ */ jsxs53("form", { onSubmit: form.handleSubmit(onSubmit), className: "w-full space-y-6", children: [
|
|
6742
|
+
/* @__PURE__ */ jsx63(
|
|
6743
|
+
FormField15,
|
|
6744
|
+
{
|
|
6745
|
+
control: form.control,
|
|
6746
|
+
name: "name",
|
|
6747
|
+
render: ({ field }) => /* @__PURE__ */ jsxs53(FormItem15, { children: [
|
|
6748
|
+
/* @__PURE__ */ jsx63(FormLabel14, { children: t("systems.ORGANIZATION_NAME") }),
|
|
6749
|
+
/* @__PURE__ */ jsx63(FormControl15, { children: /* @__PURE__ */ jsx63(
|
|
6750
|
+
Input12,
|
|
6751
|
+
{
|
|
6752
|
+
placeholder: t("systems.ORGANIZATION_NAME_PLACEHOLDER"),
|
|
6753
|
+
...field,
|
|
6754
|
+
onChange: (e) => {
|
|
6755
|
+
const v = e.target.value;
|
|
6756
|
+
field.onChange(v);
|
|
6757
|
+
form.setValue("slug", handleSlugify(v), {
|
|
6758
|
+
shouldValidate: true,
|
|
6759
|
+
shouldDirty: true
|
|
6760
|
+
});
|
|
6761
|
+
},
|
|
6762
|
+
onBlur: () => {
|
|
6763
|
+
field.onBlur();
|
|
6764
|
+
void handleSlugify(form.getValues("slug"));
|
|
6765
|
+
}
|
|
6766
|
+
}
|
|
6767
|
+
) }),
|
|
6768
|
+
/* @__PURE__ */ jsx63(FormMessage15, {})
|
|
6769
|
+
] })
|
|
6770
|
+
}
|
|
6771
|
+
),
|
|
6772
|
+
/* @__PURE__ */ jsx63(
|
|
6773
|
+
FormField15,
|
|
6774
|
+
{
|
|
6775
|
+
control: form.control,
|
|
6776
|
+
name: "slug",
|
|
6777
|
+
render: ({ field }) => /* @__PURE__ */ jsxs53(FormItem15, { children: [
|
|
6778
|
+
/* @__PURE__ */ jsx63(FormLabel14, { children: t("systems.ORGANIZATION_SLUG") }),
|
|
6779
|
+
/* @__PURE__ */ jsx63(FormControl15, { children: /* @__PURE__ */ jsx63(Input12, { placeholder: t("systems.ORGANIZATION_SLUG_PLACEHOLDER"), ...field }) }),
|
|
6780
|
+
/* @__PURE__ */ jsx63(FormMessage15, {})
|
|
6781
|
+
] })
|
|
6782
|
+
}
|
|
6783
|
+
),
|
|
6784
|
+
/* @__PURE__ */ jsxs53("div", { className: "flex flex-col gap-4", children: [
|
|
6785
|
+
/* @__PURE__ */ jsxs53(
|
|
6786
|
+
Button37,
|
|
6787
|
+
{
|
|
6788
|
+
type: "submit",
|
|
6789
|
+
className: cn44("w-full", disableSubmit && "pointer-events-auto! cursor-not-allowed"),
|
|
6790
|
+
disabled: disableSubmit,
|
|
6791
|
+
children: [
|
|
6792
|
+
isSubmitting && /* @__PURE__ */ jsx63(Spinner21, {}),
|
|
6793
|
+
t("systems.CREATE_ORGANIZATION")
|
|
6794
|
+
]
|
|
6795
|
+
}
|
|
6796
|
+
),
|
|
6797
|
+
hasWorkspaces && /* @__PURE__ */ jsx63(
|
|
6798
|
+
Link11,
|
|
6799
|
+
{
|
|
6800
|
+
href: "/",
|
|
6801
|
+
className: cn44(buttonVariants({ variant: "ghost", size: "lg" }), "w-full"),
|
|
6802
|
+
children: t("systems.common.actions.backDashboard")
|
|
6803
|
+
}
|
|
6804
|
+
)
|
|
6805
|
+
] })
|
|
6806
|
+
] }) });
|
|
6807
|
+
}
|
|
6808
|
+
|
|
6809
|
+
// src/ui/pages/verify-email.tsx
|
|
6810
|
+
import { useEffect as useEffect18, useState as useState22 } from "react";
|
|
6811
|
+
import { useRouter as useRouter20 } from "next/navigation";
|
|
6812
|
+
import { useTranslations as useTranslations52 } from "next-intl";
|
|
6813
|
+
import { cn as cn45 } from "pelatform-ui";
|
|
6814
|
+
import { AlertToast as AlertToast27 } from "pelatform-ui/components";
|
|
6815
|
+
import { Button as Button38, Card as Card13, CardContent as CardContent5, CardHeader as CardHeader4, InputOTP as InputOTP3, Spinner as Spinner22 } from "pelatform-ui/default";
|
|
6816
|
+
import { Fragment as Fragment21, jsx as jsx64, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
6817
|
+
function VerifyEmail({ className, classNames, callbackUrl, email }) {
|
|
6818
|
+
const { authClient } = useConfig();
|
|
6819
|
+
const router = useRouter20();
|
|
6820
|
+
const t = useTranslations52();
|
|
6821
|
+
const [otp, setOtp] = useState22("");
|
|
6822
|
+
const [isLoading, setIsLoading] = useState22(false);
|
|
6823
|
+
const [isResendLoading, setIsResendLoading] = useState22(false);
|
|
6824
|
+
const [isResendSuccess, setIsResendSuccess] = useState22(false);
|
|
6825
|
+
const [waitingSeconds, setWaitingSeconds] = useState22(30);
|
|
6826
|
+
useEffect18(() => {
|
|
6827
|
+
if (waitingSeconds > 0) {
|
|
6828
|
+
const timeout = setTimeout(() => {
|
|
6829
|
+
setWaitingSeconds(waitingSeconds - 1);
|
|
6830
|
+
}, 1e3);
|
|
6831
|
+
return () => clearTimeout(timeout);
|
|
6832
|
+
}
|
|
6833
|
+
if (waitingSeconds === 0 && isResendSuccess) {
|
|
6834
|
+
setIsResendSuccess(false);
|
|
6835
|
+
}
|
|
6836
|
+
}, [waitingSeconds, isResendSuccess]);
|
|
6837
|
+
const handleResendCode = async () => {
|
|
6838
|
+
setIsResendLoading(true);
|
|
6839
|
+
try {
|
|
6840
|
+
await authClient.emailOtp.sendVerificationOtp({
|
|
6841
|
+
email,
|
|
6842
|
+
type: "email-verification"
|
|
6843
|
+
});
|
|
6844
|
+
AlertToast27({
|
|
6845
|
+
message: t("systems.VERIFY_EMAIL_RESEND_SUCCESS")
|
|
6846
|
+
});
|
|
6847
|
+
} catch {
|
|
6848
|
+
AlertToast27({
|
|
6849
|
+
message: t("systems.VERIFY_EMAIL_RESEND_FAILED"),
|
|
6850
|
+
icon: "destructive"
|
|
6851
|
+
});
|
|
6852
|
+
} finally {
|
|
6853
|
+
setWaitingSeconds(30);
|
|
6854
|
+
setIsResendLoading(false);
|
|
6855
|
+
setIsResendSuccess(true);
|
|
6856
|
+
}
|
|
6857
|
+
};
|
|
6858
|
+
const handleVerifyOtp = async () => {
|
|
6859
|
+
setIsLoading(true);
|
|
6860
|
+
try {
|
|
6861
|
+
const result = await authClient.emailOtp.verifyEmail({
|
|
6862
|
+
email,
|
|
6863
|
+
otp
|
|
6864
|
+
});
|
|
6865
|
+
if (result.data) {
|
|
6866
|
+
AlertToast27({
|
|
6867
|
+
message: t("systems.VERIFY_EMAIL_SUCCESS")
|
|
6868
|
+
});
|
|
6869
|
+
router.push(callbackUrl);
|
|
6870
|
+
} else {
|
|
6871
|
+
AlertToast27({
|
|
6872
|
+
message: t("systems.VERIFY_EMAIL_FAILED"),
|
|
6873
|
+
icon: "destructive"
|
|
6874
|
+
});
|
|
6875
|
+
}
|
|
6876
|
+
} catch {
|
|
6877
|
+
AlertToast27({
|
|
6878
|
+
message: t("systems.VERIFY_EMAIL_FAILED_TRY"),
|
|
6879
|
+
icon: "destructive"
|
|
6880
|
+
});
|
|
6881
|
+
} finally {
|
|
6882
|
+
setIsLoading(false);
|
|
6883
|
+
}
|
|
6884
|
+
};
|
|
6885
|
+
const emailElement = () => /* @__PURE__ */ jsx64("span", { className: "block font-medium text-foreground", children: email });
|
|
6886
|
+
return /* @__PURE__ */ jsxs54(Card13, { className: cn45("w-full max-w-md overflow-hidden", className, classNames?.base), children: [
|
|
6887
|
+
/* @__PURE__ */ jsx64(CardHeader4, { className: "py-4", children: /* @__PURE__ */ jsx64(
|
|
6888
|
+
CardHeaderComponent,
|
|
6889
|
+
{
|
|
6890
|
+
className: "w-full text-center",
|
|
6891
|
+
title: t("systems.VERIFY_EMAIL_TITLE"),
|
|
6892
|
+
description: /* @__PURE__ */ jsxs54(Fragment21, { children: [
|
|
6893
|
+
t("systems.VERIFY_EMAIL_DESCRIPTION"),
|
|
6894
|
+
" ",
|
|
6895
|
+
emailElement()
|
|
6896
|
+
] })
|
|
6897
|
+
}
|
|
6898
|
+
) }),
|
|
6899
|
+
/* @__PURE__ */ jsxs54(CardContent5, { className: cn45("flex flex-col gap-6 truncate", classNames?.content), children: [
|
|
6900
|
+
/* @__PURE__ */ jsx64(
|
|
6901
|
+
InputOTP3,
|
|
6902
|
+
{
|
|
6903
|
+
maxLength: 6,
|
|
6904
|
+
onChange: (value) => setOtp(value),
|
|
6905
|
+
value: otp,
|
|
6906
|
+
containerClassName: "justify-center",
|
|
6907
|
+
children: /* @__PURE__ */ jsx64(OTPInputGroup, { otpSeparators: 1 })
|
|
6908
|
+
}
|
|
6909
|
+
),
|
|
6910
|
+
/* @__PURE__ */ jsxs54("div", { className: "flex w-full flex-col items-center gap-4", children: [
|
|
6911
|
+
/* @__PURE__ */ jsxs54(
|
|
6912
|
+
Button38,
|
|
6913
|
+
{
|
|
6914
|
+
className: cn45(
|
|
6915
|
+
"flex w-full items-center justify-center",
|
|
6916
|
+
otp.length !== 6 && "cursor-not-allowed"
|
|
6917
|
+
),
|
|
6918
|
+
onClick: handleVerifyOtp,
|
|
6919
|
+
disabled: otp.length !== 6,
|
|
6920
|
+
children: [
|
|
6921
|
+
isLoading && /* @__PURE__ */ jsx64(Spinner22, {}),
|
|
6922
|
+
t("systems.VERIFY_EMAIL_BUTTON")
|
|
6923
|
+
]
|
|
6924
|
+
}
|
|
6925
|
+
),
|
|
6926
|
+
/* @__PURE__ */ jsxs54("div", { className: "flex flex-col items-center gap-3", children: [
|
|
6927
|
+
/* @__PURE__ */ jsx64("p", { className: "text-muted-foreground text-sm", children: t("systems.VERIFY_EMAIL_NOT_RECEIVE") }),
|
|
6928
|
+
/* @__PURE__ */ jsxs54(
|
|
6929
|
+
Button38,
|
|
6930
|
+
{
|
|
6931
|
+
variant: "outline",
|
|
6932
|
+
className: cn45(
|
|
6933
|
+
"text-muted-foreground",
|
|
6934
|
+
isResendLoading || waitingSeconds > 0 && "cursor-not-allowed"
|
|
6935
|
+
),
|
|
6936
|
+
onClick: handleResendCode,
|
|
6937
|
+
disabled: waitingSeconds > 0,
|
|
6938
|
+
children: [
|
|
6939
|
+
isResendLoading && /* @__PURE__ */ jsx64(Spinner22, {}),
|
|
6940
|
+
isResendLoading ? `${t("systems.VERIFY_EMAIL_SENDING")}` : waitingSeconds > 0 ? `${t("systems.VERIFY_EMAIL_RESEND")} (${waitingSeconds}s)` : t("systems.VERIFY_EMAIL_RESEND")
|
|
6941
|
+
]
|
|
6942
|
+
}
|
|
6943
|
+
)
|
|
6944
|
+
] })
|
|
6326
6945
|
] })
|
|
6327
6946
|
] })
|
|
6328
6947
|
] });
|
|
@@ -6334,7 +6953,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
|
6334
6953
|
import { NextIntlClientProvider } from "next-intl";
|
|
6335
6954
|
import { QueryProvider, ThemeProvider } from "pelatform-ui/components";
|
|
6336
6955
|
import { Toaster as Sonner } from "pelatform-ui/default";
|
|
6337
|
-
import { jsx as
|
|
6956
|
+
import { jsx as jsx65, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
6338
6957
|
function SharedProviders({
|
|
6339
6958
|
children,
|
|
6340
6959
|
locale,
|
|
@@ -6343,20 +6962,161 @@ function SharedProviders({
|
|
|
6343
6962
|
sonnerPosition = "top-center"
|
|
6344
6963
|
}) {
|
|
6345
6964
|
const config = useConfig();
|
|
6346
|
-
return /* @__PURE__ */
|
|
6347
|
-
/* @__PURE__ */
|
|
6965
|
+
return /* @__PURE__ */ jsxs55(QueryProvider, { children: [
|
|
6966
|
+
/* @__PURE__ */ jsx65(ThemeProvider, { defaultTheme: config.ui.defaultTheme, children: /* @__PURE__ */ jsx65(NextIntlClientProvider, { locale, messages, timeZone, children: /* @__PURE__ */ jsxs55(Suspense2, { children: [
|
|
6348
6967
|
children,
|
|
6349
|
-
/* @__PURE__ */
|
|
6968
|
+
/* @__PURE__ */ jsx65(Sonner, { position: sonnerPosition })
|
|
6350
6969
|
] }) }) }),
|
|
6351
|
-
/* @__PURE__ */
|
|
6970
|
+
/* @__PURE__ */ jsx65(ReactQueryDevtools, { initialIsOpen: false })
|
|
6352
6971
|
] });
|
|
6353
6972
|
}
|
|
6354
6973
|
|
|
6974
|
+
// src/ui/providers/workspace.tsx
|
|
6975
|
+
import { useCallback as useCallback5, useContext as useContext14, useEffect as useEffect19, useState as useState23 } from "react";
|
|
6976
|
+
import { notFound, usePathname as usePathname5, useRouter as useRouter21 } from "next/navigation";
|
|
6977
|
+
import { useMutation as useMutation3, useQuery as useQuery3, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
6978
|
+
import { AlertToast as AlertToast28 } from "pelatform-ui/components";
|
|
6979
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
6980
|
+
function WorkspaceProvider({
|
|
6981
|
+
children,
|
|
6982
|
+
initialWorkspace,
|
|
6983
|
+
workspaceSlug,
|
|
6984
|
+
fetchWorkspaceList = "api/workspaces",
|
|
6985
|
+
fetchWorkspaceBySlug = "api/workspace/s"
|
|
6986
|
+
}) {
|
|
6987
|
+
const { authClient } = useConfig();
|
|
6988
|
+
const { queryKey } = useContext14(QueryContext);
|
|
6989
|
+
const pathname = usePathname5();
|
|
6990
|
+
const queryClient = useQueryClient3();
|
|
6991
|
+
const router = useRouter21();
|
|
6992
|
+
const [activeWorkspace, setActiveWorkspace] = useState23(initialWorkspace);
|
|
6993
|
+
const [isSwitchingWorkspace, setIsSwitchingWorkspace] = useState23(false);
|
|
6994
|
+
const shouldFetchWorkspace = !!workspaceSlug && (!activeWorkspace || activeWorkspace.slug !== workspaceSlug);
|
|
6995
|
+
const { data: usersWorkspaces } = useQuery3({
|
|
6996
|
+
queryKey: queryKey.workspaceList,
|
|
6997
|
+
queryFn: async () => {
|
|
6998
|
+
const response = await request(fetchWorkspaceList);
|
|
6999
|
+
return response.data;
|
|
7000
|
+
}
|
|
7001
|
+
});
|
|
7002
|
+
const fetchWorkspaceData = async (slug) => {
|
|
7003
|
+
try {
|
|
7004
|
+
const response = await request(`${fetchWorkspaceBySlug}/${slug}`);
|
|
7005
|
+
if (response.status === 200) {
|
|
7006
|
+
setActiveWorkspace(response.data);
|
|
7007
|
+
return response.data;
|
|
7008
|
+
}
|
|
7009
|
+
if (response.status === 404) {
|
|
7010
|
+
console.error("Workspace not found");
|
|
7011
|
+
return notFound();
|
|
7012
|
+
}
|
|
7013
|
+
console.error(`Unexpected status code: ${response.status}`);
|
|
7014
|
+
return null;
|
|
7015
|
+
} catch (error) {
|
|
7016
|
+
console.error("Failed to fetch workspace data:", error);
|
|
7017
|
+
return null;
|
|
7018
|
+
}
|
|
7019
|
+
};
|
|
7020
|
+
const { data: fetchedActiveWorkspace, isLoading: isFetchingActiveWorkspace } = useQuery3({
|
|
7021
|
+
queryKey: queryKey.workspaceBySlug(workspaceSlug),
|
|
7022
|
+
queryFn: () => fetchWorkspaceData(workspaceSlug),
|
|
7023
|
+
enabled: shouldFetchWorkspace,
|
|
7024
|
+
initialData: initialWorkspace && initialWorkspace.slug === workspaceSlug ? initialWorkspace : void 0,
|
|
7025
|
+
staleTime: 5 * 60 * 1e3,
|
|
7026
|
+
gcTime: 10 * 60 * 1e3
|
|
7027
|
+
});
|
|
7028
|
+
const { mutateAsync: updateActiveWorkspaceMutation } = useMutation3({
|
|
7029
|
+
mutationFn: async (workspace) => {
|
|
7030
|
+
setIsSwitchingWorkspace(true);
|
|
7031
|
+
setActiveWorkspace(
|
|
7032
|
+
(prev) => ({
|
|
7033
|
+
...prev,
|
|
7034
|
+
...workspace
|
|
7035
|
+
})
|
|
7036
|
+
);
|
|
7037
|
+
if (workspace.slug) {
|
|
7038
|
+
setLastVisitedWorkspace(workspace.slug);
|
|
7039
|
+
}
|
|
7040
|
+
if (!workspace.id) {
|
|
7041
|
+
throw new Error("Workspace ID is required for switching");
|
|
7042
|
+
}
|
|
7043
|
+
const { data, error } = await authClient.organization.setActive({
|
|
7044
|
+
organizationId: workspace.id
|
|
7045
|
+
});
|
|
7046
|
+
if (error) {
|
|
7047
|
+
AlertToast28({
|
|
7048
|
+
message: error.message,
|
|
7049
|
+
icon: "destructive"
|
|
7050
|
+
});
|
|
7051
|
+
throw new Error(error.message);
|
|
7052
|
+
}
|
|
7053
|
+
return data;
|
|
7054
|
+
},
|
|
7055
|
+
onSuccess: (data) => {
|
|
7056
|
+
if (data) {
|
|
7057
|
+
queryClient.removeQueries({
|
|
7058
|
+
predicate: (query) => {
|
|
7059
|
+
const key = query.queryKey;
|
|
7060
|
+
return Array.isArray(key) && key.length >= 2 && typeof key[1] === "string" && WORKSPACE_SCOPED_PREFIXES.includes(key[0]);
|
|
7061
|
+
}
|
|
7062
|
+
});
|
|
7063
|
+
queryClient.setQueryData(queryKey.workspaceBySlug(data.slug), data);
|
|
7064
|
+
queryClient.setQueryData(queryKey.workspaceById(data.id), data);
|
|
7065
|
+
const pathSegments = pathname.split("/").filter(Boolean);
|
|
7066
|
+
const pathAfterWorkspace = pathSegments.slice(1).join("/");
|
|
7067
|
+
const newPath = pathAfterWorkspace ? `/${data.slug}/${pathAfterWorkspace}` : `/${data.slug}`;
|
|
7068
|
+
router.push(newPath);
|
|
7069
|
+
}
|
|
7070
|
+
setIsSwitchingWorkspace(false);
|
|
7071
|
+
},
|
|
7072
|
+
onError: (error) => {
|
|
7073
|
+
console.error("Failed to switch workspace:", error);
|
|
7074
|
+
if (initialWorkspace) {
|
|
7075
|
+
setActiveWorkspace(initialWorkspace);
|
|
7076
|
+
setLastVisitedWorkspace(initialWorkspace.slug);
|
|
7077
|
+
}
|
|
7078
|
+
setIsSwitchingWorkspace(false);
|
|
7079
|
+
}
|
|
7080
|
+
});
|
|
7081
|
+
const updateActiveWorkspace = useCallback5(
|
|
7082
|
+
async (workspace) => {
|
|
7083
|
+
await updateActiveWorkspaceMutation(workspace);
|
|
7084
|
+
},
|
|
7085
|
+
[updateActiveWorkspaceMutation]
|
|
7086
|
+
);
|
|
7087
|
+
useEffect19(() => {
|
|
7088
|
+
if (fetchedActiveWorkspace && workspaceSlug !== fetchedActiveWorkspace.slug && !isSwitchingWorkspace) {
|
|
7089
|
+
updateActiveWorkspace(fetchedActiveWorkspace);
|
|
7090
|
+
}
|
|
7091
|
+
}, [fetchedActiveWorkspace, workspaceSlug, isSwitchingWorkspace, updateActiveWorkspace]);
|
|
7092
|
+
const isFetchingWorkspace = isFetchingActiveWorkspace || isSwitchingWorkspace;
|
|
7093
|
+
const isOwner = activeWorkspace?.currentUserRole === "owner";
|
|
7094
|
+
const isAdmin = activeWorkspace?.currentUserRole === "admin";
|
|
7095
|
+
const isMember = activeWorkspace?.currentUserRole === "member";
|
|
7096
|
+
const currentUserRole = activeWorkspace?.currentUserRole || null;
|
|
7097
|
+
return /* @__PURE__ */ jsx66(
|
|
7098
|
+
WorkspaceContext.Provider,
|
|
7099
|
+
{
|
|
7100
|
+
value: {
|
|
7101
|
+
activeWorkspace,
|
|
7102
|
+
workspaceList: usersWorkspaces ?? null,
|
|
7103
|
+
isFetchingWorkspace,
|
|
7104
|
+
isOwner,
|
|
7105
|
+
isAdmin,
|
|
7106
|
+
isMember,
|
|
7107
|
+
currentUserRole,
|
|
7108
|
+
updateActiveWorkspace
|
|
7109
|
+
},
|
|
7110
|
+
children
|
|
7111
|
+
}
|
|
7112
|
+
);
|
|
7113
|
+
}
|
|
7114
|
+
|
|
6355
7115
|
// src/ui/shared/empty-state.tsx
|
|
6356
|
-
import
|
|
6357
|
-
import { useTranslations as
|
|
6358
|
-
import { cn as
|
|
6359
|
-
import { jsx as
|
|
7116
|
+
import Link12 from "next/link";
|
|
7117
|
+
import { useTranslations as useTranslations53 } from "next-intl";
|
|
7118
|
+
import { cn as cn46 } from "pelatform-ui";
|
|
7119
|
+
import { jsx as jsx67, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
6360
7120
|
function EmptyState({
|
|
6361
7121
|
className,
|
|
6362
7122
|
icon: Icon,
|
|
@@ -6366,15 +7126,15 @@ function EmptyState({
|
|
|
6366
7126
|
learnMoreText,
|
|
6367
7127
|
children
|
|
6368
7128
|
}) {
|
|
6369
|
-
const t =
|
|
6370
|
-
return /* @__PURE__ */
|
|
6371
|
-
Icon && /* @__PURE__ */
|
|
6372
|
-
/* @__PURE__ */
|
|
6373
|
-
description && /* @__PURE__ */
|
|
7129
|
+
const t = useTranslations53();
|
|
7130
|
+
return /* @__PURE__ */ jsxs56("div", { className: cn46("flex flex-col items-center justify-center gap-y-4", className), children: [
|
|
7131
|
+
Icon && /* @__PURE__ */ jsx67("div", { className: "flex size-14 items-center justify-center rounded-2xl border bg-muted", children: /* @__PURE__ */ jsx67(Icon, { className: "size-6 text-foreground" }) }),
|
|
7132
|
+
/* @__PURE__ */ jsx67("p", { className: "text-center font-medium text-base text-foreground", children: title }),
|
|
7133
|
+
description && /* @__PURE__ */ jsxs56("p", { className: "max-w-sm text-balance text-center text-muted-foreground text-sm", children: [
|
|
6374
7134
|
description,
|
|
6375
7135
|
" ",
|
|
6376
|
-
learnMore && /* @__PURE__ */
|
|
6377
|
-
|
|
7136
|
+
learnMore && /* @__PURE__ */ jsxs56(
|
|
7137
|
+
Link12,
|
|
6378
7138
|
{
|
|
6379
7139
|
href: learnMore,
|
|
6380
7140
|
className: "text-foreground underline underline-offset-2 transition-colors hover:text-primary",
|
|
@@ -6388,24 +7148,6 @@ function EmptyState({
|
|
|
6388
7148
|
children
|
|
6389
7149
|
] });
|
|
6390
7150
|
}
|
|
6391
|
-
|
|
6392
|
-
// src/ui/shared/signed-in-hint.tsx
|
|
6393
|
-
import Link11 from "next/link";
|
|
6394
|
-
import { useTranslations as useTranslations50 } from "next-intl";
|
|
6395
|
-
import { Button as Button35 } from "pelatform-ui/default";
|
|
6396
|
-
import { jsx as jsx63, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
6397
|
-
function SignedInHint({ linkHref = "/signin" }) {
|
|
6398
|
-
const t = useTranslations50("customs.common.signed");
|
|
6399
|
-
const { isPending, user } = useSession();
|
|
6400
|
-
return /* @__PURE__ */ jsxs53("div", { className: "fixed start-0 bottom-0 z-40 m-5 flex flex-col gap-2", children: [
|
|
6401
|
-
/* @__PURE__ */ jsxs53("div", { className: "flex items-center gap-1 text-muted-foreground text-xs", children: [
|
|
6402
|
-
t("text"),
|
|
6403
|
-
" ",
|
|
6404
|
-
isPending || !user ? /* @__PURE__ */ jsx63("span", { className: "h-3 w-32 animate-pulse rounded-md border bg-muted-foreground" }) : /* @__PURE__ */ jsx63("b", { className: "text-foreground", children: user.email })
|
|
6405
|
-
] }),
|
|
6406
|
-
/* @__PURE__ */ jsx63(Button35, { variant: "mono", className: "h-8 w-fit rounded-lg px-3 text-xs shadow-sm", children: /* @__PURE__ */ jsx63(Link11, { href: linkHref, children: t("button") }) })
|
|
6407
|
-
] });
|
|
6408
|
-
}
|
|
6409
7151
|
export {
|
|
6410
7152
|
AcceptInvitation,
|
|
6411
7153
|
ApiKeyDeleteDialog,
|
|
@@ -6452,6 +7194,8 @@ export {
|
|
|
6452
7194
|
MagicLinkButton,
|
|
6453
7195
|
MagicLinkForm,
|
|
6454
7196
|
MultiAccountCard,
|
|
7197
|
+
NewWorkspace,
|
|
7198
|
+
NewWorkspaceForm,
|
|
6455
7199
|
OTPInputGroup,
|
|
6456
7200
|
OneTap,
|
|
6457
7201
|
PasskeyButton,
|
|
@@ -6471,6 +7215,7 @@ export {
|
|
|
6471
7215
|
SidebarContent,
|
|
6472
7216
|
SidebarContentMenu,
|
|
6473
7217
|
SidebarHeaderBack,
|
|
7218
|
+
SidebarHeaderWorkspaces,
|
|
6474
7219
|
SignInForm,
|
|
6475
7220
|
SignOut,
|
|
6476
7221
|
SignUpForm,
|
|
@@ -6487,7 +7232,11 @@ export {
|
|
|
6487
7232
|
UserAvatar,
|
|
6488
7233
|
UserMenu,
|
|
6489
7234
|
UserView,
|
|
7235
|
+
VerifyEmail,
|
|
7236
|
+
WorkspaceContext,
|
|
6490
7237
|
WorkspaceLogo,
|
|
7238
|
+
WorkspaceProvider,
|
|
7239
|
+
WorkspaceSwitcher,
|
|
6491
7240
|
WorkspaceView,
|
|
6492
7241
|
getUserName,
|
|
6493
7242
|
useAccountInfo,
|
|
@@ -6513,5 +7262,6 @@ export {
|
|
|
6513
7262
|
useSession,
|
|
6514
7263
|
useSetActiveSession,
|
|
6515
7264
|
useUnlinkAccount,
|
|
6516
|
-
useUpdateUser
|
|
7265
|
+
useUpdateUser,
|
|
7266
|
+
useWorkspace
|
|
6517
7267
|
};
|