Skip to content

Commit bdbb14c

Browse files
authored
feat(tasks): add tab view preference and improve task list UI.
1 parent 3ea5c1f commit bdbb14c

File tree

6 files changed

+226
-212
lines changed

6 files changed

+226
-212
lines changed

apps/app/src/actions/tasks.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use server';
2+
3+
import { addYears } from 'date-fns';
4+
import { createSafeActionClient } from 'next-safe-action';
5+
import { cookies } from 'next/headers';
6+
import { z } from 'zod';
7+
8+
const schema = z.object({
9+
view: z.enum(['categories', 'list']),
10+
orgId: z.string(),
11+
});
12+
13+
export const updateTaskViewPreference = createSafeActionClient()
14+
.inputSchema(schema)
15+
.action(async ({ parsedInput }) => {
16+
const cookieStore = await cookies();
17+
18+
cookieStore.set({
19+
name: `task-view-preference-${parsedInput.orgId}`,
20+
value: parsedInput.view,
21+
expires: addYears(new Date(), 1),
22+
});
23+
24+
return { success: true };
25+
});
26+

apps/app/src/app/(app)/[orgId]/tasks/components/SearchInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const SearchInput = forwardRef<HTMLInputElement, SearchInputProps>(
1616
ref={ref}
1717
type="text"
1818
placeholder={placeholder}
19-
className={`h-9 w-[280px] border border-input bg-background pl-10 pr-4 text-sm text-foreground placeholder:text-muted-foreground transition-all focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-md ${className}`}
19+
className={`h-9 w-full border border-input bg-background pl-10 pr-4 text-sm text-foreground placeholder:text-muted-foreground transition-all focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-md ${className}`}
2020
{...props}
2121
/>
2222
</div>

0 commit comments

Comments
 (0)