@prenta/admin 2.14.7 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/AdminRoot.d.ts.map +1 -1
- package/dist/AdminRoot.js +11 -6
- package/dist/AdminRoot.js.map +1 -1
- package/dist/LoginRoot.js +3 -3
- package/dist/LoginRoot.js.map +1 -1
- package/dist/__tests__/assets/prenta-logo.test.js +26 -10
- package/dist/__tests__/assets/prenta-logo.test.js.map +1 -1
- package/dist/__tests__/layout/sidebar-brand.render.test.js +25 -22
- package/dist/__tests__/layout/sidebar-brand.render.test.js.map +1 -1
- package/dist/__tests__/views/appearance-settings.render.test.js +9 -0
- package/dist/__tests__/views/appearance-settings.render.test.js.map +1 -1
- package/dist/__tests__/views/login-branding.render.test.js +15 -30
- package/dist/__tests__/views/login-branding.render.test.js.map +1 -1
- package/dist/assets/prenta-logo.d.ts +18 -21
- package/dist/assets/prenta-logo.d.ts.map +1 -1
- package/dist/assets/prenta-logo.js +24 -12
- package/dist/assets/prenta-logo.js.map +1 -1
- package/dist/components/AuthBranding.d.ts +40 -0
- package/dist/components/AuthBranding.d.ts.map +1 -0
- package/dist/components/AuthBranding.js +81 -0
- package/dist/components/AuthBranding.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/layout/Sidebar.d.ts.map +1 -1
- package/dist/layout/Sidebar.js +15 -23
- package/dist/layout/Sidebar.js.map +1 -1
- package/dist/prenta-admin.css +1 -1
- package/dist/views/ForgotPassword.d.ts +3 -1
- package/dist/views/ForgotPassword.d.ts.map +1 -1
- package/dist/views/ForgotPassword.js +6 -4
- package/dist/views/ForgotPassword.js.map +1 -1
- package/dist/views/Login.d.ts +2 -5
- package/dist/views/Login.d.ts.map +1 -1
- package/dist/views/Login.js +9 -74
- package/dist/views/Login.js.map +1 -1
- package/dist/views/McpConsent.js +1 -1
- package/dist/views/McpConsent.js.map +1 -1
- package/dist/views/ResetPassword.d.ts +3 -1
- package/dist/views/ResetPassword.d.ts.map +1 -1
- package/dist/views/ResetPassword.js +5 -3
- package/dist/views/ResetPassword.js.map +1 -1
- package/dist/views/SetupWizard.d.ts +3 -1
- package/dist/views/SetupWizard.d.ts.map +1 -1
- package/dist/views/SetupWizard.js +5 -3
- package/dist/views/SetupWizard.js.map +1 -1
- package/dist/views/settings/BrandPreviewCard.d.ts.map +1 -1
- package/dist/views/settings/BrandPreviewCard.js +5 -6
- package/dist/views/settings/BrandPreviewCard.js.map +1 -1
- package/dist/views/settings/BrandingCard.d.ts.map +1 -1
- package/dist/views/settings/BrandingCard.js +4 -3
- package/dist/views/settings/BrandingCard.js.map +1 -1
- package/package.json +6 -6
- package/src/AdminRoot.tsx +15 -5
- package/src/LoginRoot.tsx +9 -2
- package/src/__tests__/assets/prenta-logo.test.tsx +27 -10
- package/src/__tests__/layout/sidebar-brand.render.test.tsx +29 -25
- package/src/__tests__/views/appearance-settings.render.test.tsx +11 -0
- package/src/__tests__/views/login-branding.render.test.tsx +15 -30
- package/src/assets/prenta-logo.tsx +55 -53
- package/src/components/AuthBranding.tsx +125 -0
- package/src/index.ts +2 -0
- package/src/layout/Sidebar.tsx +51 -49
- package/src/views/ForgotPassword.tsx +12 -5
- package/src/views/Login.tsx +15 -89
- package/src/views/McpConsent.tsx +3 -3
- package/src/views/ResetPassword.tsx +12 -5
- package/src/views/SetupWizard.tsx +12 -5
- package/src/views/settings/BrandPreviewCard.tsx +20 -27
- package/src/views/settings/BrandingCard.tsx +18 -1
- package/dist/components/LogoPlaceholder.d.ts +0 -17
- package/dist/components/LogoPlaceholder.d.ts.map +0 -1
- package/dist/components/LogoPlaceholder.js +0 -13
- package/dist/components/LogoPlaceholder.js.map +0 -1
- package/src/components/LogoPlaceholder.tsx +0 -55
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { DEFAULT_PRENTA_FAVICON_DATA_URI, type ResolvedAdminBrand } from '@prenta/core/appearance'
|
|
4
4
|
|
|
5
|
+
import { PrentaBrandLogo, PrentaMark } from '../../assets/prenta-logo.js'
|
|
5
6
|
import type { UseAppearanceSettings } from './useAppearanceSettings.js'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<span
|
|
10
|
-
className={`bg-brand text-brand-foreground inline-flex shrink-0 items-center justify-center rounded-md font-medium ${size}`}
|
|
11
|
-
aria-hidden="true"
|
|
12
|
-
>
|
|
13
|
-
{initials}
|
|
14
|
-
</span>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** Expanded sidebar lockup preview (primary → mark+title → initials). */
|
|
8
|
+
/** Expanded sidebar lockup preview (uploaded logo → mark+title → Prenta placeholder). */
|
|
19
9
|
function SidebarPreview({ admin, dark }: { admin: ResolvedAdminBrand; dark?: boolean }) {
|
|
20
10
|
const logo = dark && admin.dark ? admin.dark : admin.primary
|
|
21
11
|
return (
|
|
@@ -34,12 +24,9 @@ function SidebarPreview({ admin, dark }: { admin: ResolvedAdminBrand; dark?: boo
|
|
|
34
24
|
</span>
|
|
35
25
|
</>
|
|
36
26
|
) : (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Admin
|
|
41
|
-
</span>
|
|
42
|
-
</>
|
|
27
|
+
<PrentaBrandLogo
|
|
28
|
+
className={`h-6 w-auto ${dark ? 'text-background' : 'text-sidebar-foreground'}`}
|
|
29
|
+
/>
|
|
43
30
|
)}
|
|
44
31
|
</div>
|
|
45
32
|
)
|
|
@@ -78,11 +65,17 @@ export function BrandPreviewCard({ s }: { s: UseAppearanceSettings }) {
|
|
|
78
65
|
</PreviewTile>
|
|
79
66
|
|
|
80
67
|
<PreviewTile label="Collapsed sidebar">
|
|
81
|
-
<div className="bg-sidebar border-sidebar-border flex h-14 w-14 items-center justify-center rounded-md border">
|
|
68
|
+
<div className="bg-sidebar border-sidebar-border flex h-14 w-14 items-center justify-center rounded-md border p-2">
|
|
82
69
|
{admin.mark ? (
|
|
83
70
|
<img src={admin.mark.url} alt={admin.mark.alt} className="h-8 w-8 object-contain" />
|
|
71
|
+
) : admin.primary ? (
|
|
72
|
+
<img
|
|
73
|
+
src={admin.primary.url}
|
|
74
|
+
alt={admin.primary.alt}
|
|
75
|
+
className="max-h-full max-w-full object-contain"
|
|
76
|
+
/>
|
|
84
77
|
) : (
|
|
85
|
-
<
|
|
78
|
+
<PrentaMark className="text-sidebar-foreground h-auto w-8 object-contain" />
|
|
86
79
|
)}
|
|
87
80
|
</div>
|
|
88
81
|
</PreviewTile>
|
|
@@ -105,18 +98,18 @@ export function BrandPreviewCard({ s }: { s: UseAppearanceSettings }) {
|
|
|
105
98
|
<span className="text-foreground text-sm">{pub.initials}</span>
|
|
106
99
|
</>
|
|
107
100
|
) : (
|
|
108
|
-
<
|
|
101
|
+
<PrentaBrandLogo className="text-foreground h-6 w-auto" />
|
|
109
102
|
)}
|
|
110
103
|
</div>
|
|
111
104
|
</PreviewTile>
|
|
112
105
|
|
|
113
106
|
<PreviewTile label="Favicon">
|
|
114
107
|
<div className="border-border bg-muted flex h-14 w-14 items-center justify-center rounded-md border p-2">
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
<img
|
|
109
|
+
src={faviconUrl ?? DEFAULT_PRENTA_FAVICON_DATA_URI}
|
|
110
|
+
alt="Favicon preview"
|
|
111
|
+
className="h-8 w-8 object-contain"
|
|
112
|
+
/>
|
|
120
113
|
</div>
|
|
121
114
|
</PreviewTile>
|
|
122
115
|
</div>
|
|
@@ -10,8 +10,9 @@ import {
|
|
|
10
10
|
Trash2,
|
|
11
11
|
Upload,
|
|
12
12
|
} from 'lucide-react'
|
|
13
|
-
import { useRef, useState } from 'react'
|
|
13
|
+
import { useRef, useState, type ReactNode } from 'react'
|
|
14
14
|
|
|
15
|
+
import { PrentaBrandLogo, PrentaMark } from '../../assets/prenta-logo.js'
|
|
15
16
|
import { MediaPickerModal } from '../../components/MediaPickerModal.js'
|
|
16
17
|
import { SettingsCard, SettingsControlRow, SettingsSubsection } from './components.js'
|
|
17
18
|
import {
|
|
@@ -38,6 +39,7 @@ function LogoField({
|
|
|
38
39
|
accept,
|
|
39
40
|
square,
|
|
40
41
|
darkSurface,
|
|
42
|
+
placeholder,
|
|
41
43
|
brand,
|
|
42
44
|
assets,
|
|
43
45
|
uploadingField,
|
|
@@ -53,6 +55,7 @@ function LogoField({
|
|
|
53
55
|
accept: string
|
|
54
56
|
square?: boolean
|
|
55
57
|
darkSurface?: boolean
|
|
58
|
+
placeholder?: ReactNode
|
|
56
59
|
brand: UseAppearanceSettings['brand']
|
|
57
60
|
assets: UseAppearanceSettings['assets']
|
|
58
61
|
uploadingField: BrandAssetField | null
|
|
@@ -88,6 +91,8 @@ function LogoField({
|
|
|
88
91
|
className="max-h-full max-w-full object-contain"
|
|
89
92
|
onError={() => setThumbErrorUrl(asset!.url)}
|
|
90
93
|
/>
|
|
94
|
+
) : placeholder ? (
|
|
95
|
+
placeholder
|
|
91
96
|
) : (
|
|
92
97
|
<ImageIcon size={18} className="text-muted-foreground" aria-hidden="true" />
|
|
93
98
|
)}
|
|
@@ -255,6 +260,12 @@ export function BrandingCard({ s, canEdit }: { s: UseAppearanceSettings; canEdit
|
|
|
255
260
|
label="Primary logo"
|
|
256
261
|
helper="SVG, PNG, WebP, JPEG, GIF, or AVIF, up to 1MB. Best for the public header and full admin sidebar."
|
|
257
262
|
field="publicPrimaryLogoAssetId"
|
|
263
|
+
placeholder={
|
|
264
|
+
<PrentaBrandLogo
|
|
265
|
+
decorative
|
|
266
|
+
className="text-muted-foreground max-h-full max-w-full opacity-60"
|
|
267
|
+
/>
|
|
268
|
+
}
|
|
258
269
|
warning={warningFor('publicPrimaryLogoAssetId')}
|
|
259
270
|
{...logoFieldProps}
|
|
260
271
|
/>
|
|
@@ -264,6 +275,12 @@ export function BrandingCard({ s, canEdit }: { s: UseAppearanceSettings; canEdit
|
|
|
264
275
|
helper="32×32 SVG, PNG, or WebP. A larger square image is fine — it scales down cleanly."
|
|
265
276
|
field="faviconSourceAssetId"
|
|
266
277
|
square
|
|
278
|
+
placeholder={
|
|
279
|
+
<PrentaMark
|
|
280
|
+
decorative
|
|
281
|
+
className="text-muted-foreground max-h-full max-w-full opacity-60"
|
|
282
|
+
/>
|
|
283
|
+
}
|
|
267
284
|
warning={warningFor('faviconSourceAssetId')}
|
|
268
285
|
{...logoFieldProps}
|
|
269
286
|
accept={FAVICON_ACCEPT}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Neutral "logo goes here" placeholder shown when no brand logo has been
|
|
3
|
-
* uploaded or configured. Deliberately reads as an empty slot — a dashed
|
|
4
|
-
* outline with a muted image icon — rather than a filled initials badge, which
|
|
5
|
-
* looks like a user avatar (the real account avatar already lives top-right).
|
|
6
|
-
*
|
|
7
|
-
* It is automatically superseded the moment a logo is set in Settings →
|
|
8
|
-
* Appearance, since every logo branch takes precedence over this fallback.
|
|
9
|
-
*/
|
|
10
|
-
export interface LogoPlaceholderProps {
|
|
11
|
-
/** Color treatment so the slot blends with its surface. */
|
|
12
|
-
tone: 'sidebar' | 'login';
|
|
13
|
-
/** Brand/site name rendered beside the slot (expanded sidebar only). */
|
|
14
|
-
label?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function LogoPlaceholder({ tone, label }: LogoPlaceholderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
//# sourceMappingURL=LogoPlaceholder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogoPlaceholder.d.ts","sourceRoot":"","sources":["../../src/components/LogoPlaceholder.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,IAAI,EAAE,SAAS,GAAG,OAAO,CAAA;IACzB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,oBAAoB,2CAkCpE"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ImagePlus } from 'lucide-react';
|
|
4
|
-
export function LogoPlaceholder({ tone, label }) {
|
|
5
|
-
if (tone === 'login') {
|
|
6
|
-
return (_jsx("span", { role: "img", "aria-label": "Logo placeholder", title: "Add a logo in Settings \u2192 Appearance", className: "border-border text-muted-foreground mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-lg border border-dashed", children: _jsx(ImagePlus, { className: "h-6 w-6", "aria-hidden": "true" }) }));
|
|
7
|
-
}
|
|
8
|
-
const slot = (_jsx("span", { className: "border-sidebar-border text-sidebar-foreground/50 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-dashed", role: label ? undefined : 'img', "aria-hidden": label ? true : undefined, "aria-label": label ? undefined : 'Logo placeholder', title: "Add a logo in Settings \u2192 Appearance", children: _jsx(ImagePlus, { size: 16, "aria-hidden": "true" }) }));
|
|
9
|
-
if (!label)
|
|
10
|
-
return slot;
|
|
11
|
-
return (_jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [slot, _jsx("span", { className: "text-sidebar-foreground truncate text-sm font-medium", children: label })] }));
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=LogoPlaceholder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogoPlaceholder.js","sourceRoot":"","sources":["../../src/components/LogoPlaceholder.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAkBxC,MAAM,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAwB;IACnE,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,CACL,eACE,IAAI,EAAC,KAAK,gBACC,kBAAkB,EAC7B,KAAK,EAAC,0CAAqC,EAC3C,SAAS,EAAC,6HAA6H,YAEvI,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,iBAAa,MAAM,GAAG,GAC/C,CACR,CAAA;IACH,CAAC;IAED,MAAM,IAAI,GAAG,CACX,eACE,SAAS,EAAC,2IAA2I,EACrJ,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,iBAClB,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,gBACzB,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,EAClD,KAAK,EAAC,0CAAqC,YAE3C,KAAC,SAAS,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,GACrC,CACR,CAAA;IAED,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,OAAO,CACL,eAAK,SAAS,EAAC,mCAAmC,aAC/C,IAAI,EACL,eAAM,SAAS,EAAC,sDAAsD,YAAE,KAAK,GAAQ,IACjF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { ImagePlus } from 'lucide-react'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Neutral "logo goes here" placeholder shown when no brand logo has been
|
|
7
|
-
* uploaded or configured. Deliberately reads as an empty slot — a dashed
|
|
8
|
-
* outline with a muted image icon — rather than a filled initials badge, which
|
|
9
|
-
* looks like a user avatar (the real account avatar already lives top-right).
|
|
10
|
-
*
|
|
11
|
-
* It is automatically superseded the moment a logo is set in Settings →
|
|
12
|
-
* Appearance, since every logo branch takes precedence over this fallback.
|
|
13
|
-
*/
|
|
14
|
-
export interface LogoPlaceholderProps {
|
|
15
|
-
/** Color treatment so the slot blends with its surface. */
|
|
16
|
-
tone: 'sidebar' | 'login'
|
|
17
|
-
/** Brand/site name rendered beside the slot (expanded sidebar only). */
|
|
18
|
-
label?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function LogoPlaceholder({ tone, label }: LogoPlaceholderProps) {
|
|
22
|
-
if (tone === 'login') {
|
|
23
|
-
return (
|
|
24
|
-
<span
|
|
25
|
-
role="img"
|
|
26
|
-
aria-label="Logo placeholder"
|
|
27
|
-
title="Add a logo in Settings → Appearance"
|
|
28
|
-
className="border-border text-muted-foreground mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-lg border border-dashed"
|
|
29
|
-
>
|
|
30
|
-
<ImagePlus className="h-6 w-6" aria-hidden="true" />
|
|
31
|
-
</span>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const slot = (
|
|
36
|
-
<span
|
|
37
|
-
className="border-sidebar-border text-sidebar-foreground/50 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-dashed"
|
|
38
|
-
role={label ? undefined : 'img'}
|
|
39
|
-
aria-hidden={label ? true : undefined}
|
|
40
|
-
aria-label={label ? undefined : 'Logo placeholder'}
|
|
41
|
-
title="Add a logo in Settings → Appearance"
|
|
42
|
-
>
|
|
43
|
-
<ImagePlus size={16} aria-hidden="true" />
|
|
44
|
-
</span>
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
if (!label) return slot
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<div className="flex min-w-0 items-center gap-2.5">
|
|
51
|
-
{slot}
|
|
52
|
-
<span className="text-sidebar-foreground truncate text-sm font-medium">{label}</span>
|
|
53
|
-
</div>
|
|
54
|
-
)
|
|
55
|
-
}
|