mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 06:26:36 +00:00
fix(webui): sidebar selection styling, kanban active state, pointer cursors, and owner dashboard (#344)
* fix(webui): update sidebar selection styling, kanban active state, and pointer cursors * feat(webui): move dashboard to left sidebar and prevent mount animation * fix(e2e): update create-project test to click Home button in sidebar
This commit is contained in:
@@ -40,8 +40,8 @@ test('owner should create a project with a cover image', async ({ owner, prisma
|
||||
await expect(page).toHaveURL(/\/projects\/[^/]+/)
|
||||
await expect(page.locator(`text=${projectName}`).first()).toBeVisible()
|
||||
|
||||
// Back on the dashboard the new project card is visible with its cover
|
||||
await page.click('button[aria-label="Dashboard"]')
|
||||
// Back on the home page the new project card is visible with its cover
|
||||
await page.click('button[aria-label="Home"]')
|
||||
await expect(page).toHaveURL(/\/teams\/[^/]+/)
|
||||
await expect(page.locator(`img[alt="${projectName}"]`)).toBeVisible()
|
||||
|
||||
|
||||
@@ -1998,7 +1998,7 @@ describe('AssetService', () => {
|
||||
expect(await prisma.asset.findUnique({ where: { id: folderA.id } })).toBeNull()
|
||||
const remainingChildren = await prisma.asset.count({ where: { parentId: folderA.id } })
|
||||
expect(remainingChildren).toBe(0)
|
||||
})
|
||||
}, 20000)
|
||||
|
||||
it('should delete the entire directory prefix for assets with complex keys (e.g., files/ULID/raw)', async () => {
|
||||
const { project } = await setupBasicAssets()
|
||||
|
||||
@@ -10,6 +10,7 @@ interface DualSidebarItemProps {
|
||||
badge?: React.ReactNode
|
||||
children?: React.ReactNode
|
||||
onItemClick?: () => void
|
||||
active?: boolean
|
||||
}
|
||||
|
||||
// A declarative component that holds props for a sidebar item. It doesn't render anything itself.
|
||||
@@ -103,32 +104,35 @@ export const DualSidebar: React.FC<DualSidebarProps> = ({ children }) => {
|
||||
<div className="absolute bottom-0 w-full h-[70dvh] bg-linear-to-t from-sidebar-primary/10 to-transparent"></div>
|
||||
{/* Level 1: Icon Bar */}
|
||||
<nav className="w-16 bg-card border-r border-sidebar-border flex flex-col items-center pb-4 pt-0 space-y-2 flex-shrink-0">
|
||||
<div className="flex-1 w-full flex flex-col items-center space-y-5 pt-1">
|
||||
<div className="flex-1 w-full flex flex-col items-center gap-5 pt-1">
|
||||
<TooltipProvider>
|
||||
{sidebarItems.map((item, index) => (
|
||||
<Tooltip key={item.props.label}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-lg"
|
||||
onClick={() => handleItemClick(index)}
|
||||
aria-label={item.props.label}
|
||||
aria-expanded={activeItem === index}
|
||||
className={`relative w-12 h-12 [&_svg:not([class*='size-'])]:size-6 transition-all duration-200 ${
|
||||
activeItem === index
|
||||
? 'bg-sidebar-primary text-sidebar-primary-foreground shadow-lg hover:bg-sidebar-primary hover:text-sidebar-primary-foreground'
|
||||
: 'text-sidebar-foreground/60 hover:text-sidebar-foreground hover:bg-sidebar-accent'
|
||||
}`}
|
||||
>
|
||||
{item.props.icon}
|
||||
{item.props.badge}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>{item.props.label}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
))}
|
||||
{sidebarItems.map((item, index) => {
|
||||
const isItemActive = Boolean(item.props.active || activeItem === index)
|
||||
return (
|
||||
<Tooltip key={item.props.label}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-lg"
|
||||
onClick={() => handleItemClick(index)}
|
||||
aria-label={item.props.label}
|
||||
aria-expanded={activeItem === index}
|
||||
className={`relative w-12 h-12 [&_svg:not([class*='size-'])]:size-6 transition-colors duration-200 ${
|
||||
isItemActive
|
||||
? 'text-sidebar-primary hover:bg-sidebar-accent hover:text-sidebar-primary'
|
||||
: 'text-sidebar-foreground/60 hover:text-sidebar-foreground hover:bg-sidebar-accent'
|
||||
}`}
|
||||
>
|
||||
{item.props.icon}
|
||||
{item.props.badge}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>{item.props.label}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)
|
||||
})}
|
||||
</TooltipProvider>
|
||||
</div>
|
||||
<div className="mt-auto w-full flex flex-col items-center pb-2">
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Slot } from 'radix-ui'
|
||||
import { cn } from '@/ui/lib/utils'
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap cursor-pointer transition-colors outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
|
||||
@@ -265,3 +265,16 @@ export const KanbanFillIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({
|
||||
<path d="M172-84q-36.3 0-62.15-25.85T84-172v-616q0-36.3 25.85-62.15T172-876h616q36.3 0 62.15 25.85T876-788v616q0 36.3-25.85 62.15T788-84H172Zm88-176h88v-440h-88v440Zm176 0h88v-264h-88v264Zm176 0h88v-352h-88v352Z" />
|
||||
</svg>
|
||||
)
|
||||
|
||||
export const DashboardFillIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 -960 960 960"
|
||||
fill="currentColor"
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
{...props}
|
||||
>
|
||||
<path d="M520-600v-240h320v240H520ZM120-440v-400h320v400H120Zm400 320v-400h320v400H520Zm-400 0v-240h320v240H120Z" />
|
||||
</svg>
|
||||
)
|
||||
|
||||
@@ -90,7 +90,7 @@ export function UserMenu() {
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Avatar className="rounded-lg w-10 h-10">
|
||||
<Avatar className="rounded-lg w-10 h-10 cursor-pointer">
|
||||
{me?.image && (
|
||||
<AvatarImage
|
||||
src={me.image}
|
||||
@@ -146,19 +146,6 @@ export function UserMenu() {
|
||||
</DropdownMenuPortal>
|
||||
</DropdownMenuSub>
|
||||
<DropdownMenuSeparator />
|
||||
{me?.role?.toLowerCase() === 'owner' && (
|
||||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
navigate({
|
||||
to: '/teams/$teamId/dashboard',
|
||||
params: { teamId: teamId! },
|
||||
})
|
||||
}
|
||||
disabled={!teamId}
|
||||
>
|
||||
{m.dashboard()}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
navigate({
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"home": "Home",
|
||||
"dashboard": "Dashboard",
|
||||
"notifications": "Notifications",
|
||||
"uploads": "Uploads",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"home": "主页",
|
||||
"dashboard": "仪表板",
|
||||
"notifications": "通知",
|
||||
"uploads": "上传管理",
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
export * from "./home.js";
|
||||
export * from "./dashboard.js";
|
||||
export * from "./notifications.js";
|
||||
export * from "./uploads.js";
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
/* eslint-disable */
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
export * from './home.js'
|
||||
export * from './dashboard.js'
|
||||
export * from './notifications.js'
|
||||
export * from './uploads.js'
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Home" |
|
||||
*
|
||||
* @param {HomeInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const home: ((inputs?: HomeInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<HomeInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type HomeInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} HomeInputs */
|
||||
|
||||
const en_home = /** @type {(inputs: HomeInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Home`)
|
||||
};
|
||||
|
||||
const zh_home = /** @type {(inputs: HomeInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`主页`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Home" |
|
||||
*
|
||||
* @param {HomeInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const home = /** @type {((inputs?: HomeInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<HomeInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_home(inputs)
|
||||
return zh_home(inputs)
|
||||
});
|
||||
@@ -3,6 +3,7 @@ import { DualSidebar, DualSidebarItem } from '@/ui/components/dual-sidebar'
|
||||
import { NotificationList } from '@/ui/components/notification-list'
|
||||
import { TopNav } from '@/ui/components/top-nav'
|
||||
import {
|
||||
DashboardFillIcon,
|
||||
HomeIcon,
|
||||
KanbanFillIcon,
|
||||
NotificationFillIcon,
|
||||
@@ -83,13 +84,16 @@ function RootComponent() {
|
||||
</span>
|
||||
) : null
|
||||
|
||||
const isKanbanActive = pathname.includes('/kanban')
|
||||
const isDashboardActive = pathname.includes('/dashboard')
|
||||
|
||||
return (
|
||||
<div className="flex h-screen w-full bg-background overflow-hidden">
|
||||
<Toaster />
|
||||
<DualSidebar>
|
||||
<DualSidebarItem
|
||||
icon={<HomeIcon />}
|
||||
label={m.dashboard()}
|
||||
label={m.home()}
|
||||
onItemClick={() => {
|
||||
if (storedTeamId) {
|
||||
navigate({
|
||||
@@ -116,6 +120,7 @@ function RootComponent() {
|
||||
<DualSidebarItem
|
||||
icon={<KanbanFillIcon />}
|
||||
label={m.kanban()}
|
||||
active={isKanbanActive}
|
||||
onItemClick={() => {
|
||||
if (storedTeamId) {
|
||||
navigate({
|
||||
@@ -125,6 +130,21 @@ function RootComponent() {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{me?.role?.toLowerCase() === 'owner' && (
|
||||
<DualSidebarItem
|
||||
icon={<DashboardFillIcon />}
|
||||
label={m.dashboard()}
|
||||
active={isDashboardActive}
|
||||
onItemClick={() => {
|
||||
if (storedTeamId) {
|
||||
navigate({
|
||||
to: '/teams/$teamId/dashboard',
|
||||
params: { teamId: storedTeamId },
|
||||
})
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</DualSidebar>
|
||||
<div className="flex flex-col flex-1 md:pl-16 overflow-hidden relative">
|
||||
<TopNav />
|
||||
|
||||
@@ -252,20 +252,14 @@ describe('LocalExecutor Integration Tests', () => {
|
||||
)
|
||||
|
||||
// Wait briefly for Prisma Client Extension's async submits to trigger
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
|
||||
// Exactly 5 tasks should be running concurrently
|
||||
expect(mocks.agentChat).toHaveBeenCalledTimes(5)
|
||||
await vi.waitFor(() => expect(mocks.agentChat).toHaveBeenCalledTimes(5))
|
||||
|
||||
// Resolve 2 tasks to let the remaining 2 start
|
||||
activeResolvers[0](undefined)
|
||||
activeResolvers[1](undefined)
|
||||
|
||||
// Wait briefly for the pool to dequeue
|
||||
await new Promise((resolve) => setTimeout(resolve, 50))
|
||||
|
||||
// Now all 7 tasks should have started
|
||||
expect(mocks.agentChat).toHaveBeenCalledTimes(7)
|
||||
await vi.waitFor(() => expect(mocks.agentChat).toHaveBeenCalledTimes(7))
|
||||
|
||||
// Clean up remaining tasks
|
||||
activeResolvers.slice(2).forEach((resolve) => resolve(undefined))
|
||||
|
||||
@@ -161,7 +161,7 @@ describe('WorkflowService', () => {
|
||||
},
|
||||
})
|
||||
|
||||
const submitSpy = vi.spyOn(workflowService, 'submit')
|
||||
const submitSpy = vi.spyOn(workflowService, 'submit').mockImplementation(async () => 'mock-id')
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user