fix: rebrand Shadboard → CannaManage, staff permissions UX
- Sidebar, footer, bottom-bar-header: replaced 'Shadboard' with 'CannaManage' - Footer: removed 'Designed by Qualiora' attribution - Staff permissions: single-column layout, alphabetically sorted by label - Edit permissions dialog: useEffect syncs state when dialog opens (fixes pre-fill not working when controlled externally)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import {
|
import {
|
||||||
useInviteStaffMutation,
|
useInviteStaffMutation,
|
||||||
useRevokeStaffMutation,
|
useRevokeStaffMutation,
|
||||||
@@ -157,22 +157,24 @@ function PermissionCheckboxes({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
<div className="grid grid-cols-1 gap-3">
|
||||||
{ALL_PERMISSIONS.map((perm) => (
|
{[...ALL_PERMISSIONS]
|
||||||
<div key={perm} className="flex items-center space-x-2">
|
.sort((a, b) => permLabels[a].localeCompare(permLabels[b]))
|
||||||
<Checkbox
|
.map((perm) => (
|
||||||
id={`perm-${perm}`}
|
<div key={perm} className="flex items-center space-x-2">
|
||||||
checked={selected.includes(perm)}
|
<Checkbox
|
||||||
onCheckedChange={() => toggle(perm)}
|
id={`perm-${perm}`}
|
||||||
/>
|
checked={selected.includes(perm)}
|
||||||
<Label
|
onCheckedChange={() => toggle(perm)}
|
||||||
htmlFor={`perm-${perm}`}
|
/>
|
||||||
className="cursor-pointer text-sm font-normal"
|
<Label
|
||||||
>
|
htmlFor={`perm-${perm}`}
|
||||||
{permLabels[perm]}
|
className="cursor-pointer text-sm font-normal"
|
||||||
</Label>
|
>
|
||||||
</div>
|
{permLabels[perm]}
|
||||||
))}
|
</Label>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -311,11 +313,14 @@ function EditPermissionsDialog({
|
|||||||
staffMember?.id ?? ""
|
staffMember?.id ?? ""
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sync permissions when staff member changes
|
// Sync permissions whenever the dialog opens or staff member changes
|
||||||
const handleOpen = (isOpen: boolean) => {
|
useEffect(() => {
|
||||||
if (isOpen && staffMember) {
|
if (open && staffMember) {
|
||||||
setPermissions([...staffMember.permissions])
|
setPermissions([...staffMember.permissions])
|
||||||
}
|
}
|
||||||
|
}, [open, staffMember])
|
||||||
|
|
||||||
|
const handleOpen = (isOpen: boolean) => {
|
||||||
onOpenChange(isOpen)
|
onOpenChange(isOpen)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +1,11 @@
|
|||||||
import { cn } from "@/lib/utils"
|
|
||||||
|
|
||||||
import { buttonVariants } from "@/components/ui/button"
|
|
||||||
|
|
||||||
export function Footer() {
|
export function Footer() {
|
||||||
const currentYear = new Date().getFullYear()
|
const currentYear = new Date().getFullYear()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer className="bg-background border-t border-sidebar-border">
|
<footer className="bg-background border-t border-sidebar-border">
|
||||||
<div className="container flex justify-between items-center p-4 md:px-6">
|
<div className="container flex items-center p-4 md:px-6">
|
||||||
<p className="text-xs text-muted-foreground md:text-sm">
|
<p className="text-xs text-muted-foreground md:text-sm">
|
||||||
© {currentYear}{" "}
|
© {currentYear} CannaManage
|
||||||
<a
|
|
||||||
href="/"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className={cn(buttonVariants({ variant: "link" }), "inline p-0")}
|
|
||||||
>
|
|
||||||
Shadboard
|
|
||||||
</a>
|
|
||||||
.
|
|
||||||
</p>
|
|
||||||
<p className="text-xs text-muted-foreground md:text-sm">
|
|
||||||
Designed & Developed by{" "}
|
|
||||||
<a
|
|
||||||
href="https://github.com/Qualiora"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className={cn(buttonVariants({ variant: "link" }), "inline p-0")}
|
|
||||||
>
|
|
||||||
Qualiora
|
|
||||||
</a>
|
|
||||||
.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export function BottomBarHeader() {
|
|||||||
width={24}
|
width={24}
|
||||||
className="dark:invert"
|
className="dark:invert"
|
||||||
/>
|
/>
|
||||||
<span>Shadboard</span>
|
<span>CannaManage</span>
|
||||||
</Link>
|
</Link>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<FullscreenToggle />
|
<FullscreenToggle />
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ export function Sidebar() {
|
|||||||
width={24}
|
width={24}
|
||||||
className="dark:invert"
|
className="dark:invert"
|
||||||
/>
|
/>
|
||||||
<span>Shadboard</span>
|
<span>CannaManage</span>
|
||||||
</Link>
|
</Link>
|
||||||
<CommandMenu buttonClassName="max-w-full" />
|
<CommandMenu buttonClassName="max-w-full" />
|
||||||
</SidebarHeader>
|
</SidebarHeader>
|
||||||
|
|||||||
Reference in New Issue
Block a user