Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ import { toStartOfDay } from "@/lib/utils/date";
import { useTRPC } from "@/trpc/client";
import { useQueries } from "@tanstack/react-query";
import { useParams } from "next/navigation";
import { parseAsBoolean, useQueryState } from "nuqs";

export default function TaskLists() {
const { projectId, tasklistId } = useParams();
const [showDeleted, setShowDeleted] = useQueryState(
"showDeleted",
parseAsBoolean.withDefault(false),
);

const trpc = useTRPC();
const [{ data: list }, { data: timezone }, { data: project }] = useQueries({
Expand Down Expand Up @@ -127,6 +132,8 @@ export default function TaskLists() {
id={list.id}
hideHeader
canEdit={project.canEdit}
showDeleted={showDeleted}
onShowDeletedChange={setShowDeleted}
/>
</TasksProvider>

Expand Down
8 changes: 1 addition & 7 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { ClerkProvider } from "@clerk/nextjs";
import { Analytics } from "@vercel/analytics/next";
import { Geist } from "next/font/google";
import { ThemeProvider } from "@/components/core/theme-provider";
import { Toaster } from "@/components/ui/sonner";
import { SITE_METADATA } from "@/data/marketing";
import { cn } from "@/lib/utils";
import "./globals.css";

const mainFont = Geist({
subsets: ["latin"],
});

export const metadata = {
metadataBase: new URL(
process.env.NEXT_PUBLIC_APP_URL || "https://managee.xyz",
Expand Down Expand Up @@ -85,7 +79,7 @@ export default function RootLayout({
return (
<html
lang="en"
className={cn("dark flex min-h-full min-w-full", mainFont.className)}
className="dark flex min-h-full min-w-full"
suppressHydrationWarning
>
<head>
Expand Down
6 changes: 6 additions & 0 deletions components/core/panel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import * as Dialog from "@radix-ui/react-dialog";
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
import { memo } from "react";
import { useIsMobile } from "@/hooks/use-mobile";
import { cn } from "@/lib/utils";
Expand All @@ -10,11 +11,13 @@ export const Panel = memo(function Panel({
setOpen,
children,
className,
title = "Panel",
}: {
open: boolean;
setOpen?: (open: boolean) => void;
children: React.ReactNode;
className?: string;
title?: string;
}) {
const isMobile = useIsMobile();

Expand All @@ -31,6 +34,9 @@ export const Panel = memo(function Panel({
className,
)}
>
<VisuallyHidden>
<Dialog.Title>{title}</Dialog.Title>
</VisuallyHidden>
{children}
</Dialog.Content>
</Dialog.Portal>
Expand Down
20 changes: 15 additions & 5 deletions components/project/tasklist/task/task-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { Close, Title } from "@radix-ui/react-dialog";
import { useQueries } from "@tanstack/react-query";
import { AlignJustifyIcon, CalendarClock, FileIcon, X } from "lucide-react";
import { useParams } from "next/navigation";
import { useMemo, useState } from "react";
import { parseAsInteger, useQueryState } from "nuqs";
import { useMemo } from "react";
import { toast } from "sonner";
import { Panel } from "@/components/core/panel";
import { ConfirmButton } from "@/components/form/button";
Expand Down Expand Up @@ -44,7 +45,11 @@ export const TaskItem = ({
canEdit?: boolean;
}) => {
const { projectId } = useParams();
const [detailsOpen, setDetailsOpen] = useState(false);
const [selectedTaskId, setSelectedTaskId] = useQueryState(
"task",
parseAsInteger,
);
const detailsOpen = selectedTaskId === task.id;
const { attributes, listeners, setNodeRef, transform, transition } =
useSortable({ id: task.id });

Expand Down Expand Up @@ -113,7 +118,7 @@ export const TaskItem = ({
creating ? "text-muted-foreground" : "",
)}
onClick={() => {
if (!creating) setDetailsOpen(true);
if (!creating) setSelectedTaskId(task.id);
}}
>
<div
Expand Down Expand Up @@ -155,7 +160,12 @@ export const TaskItem = ({
) : null}
</div>

<Panel open={detailsOpen} setOpen={setDetailsOpen}>
<Panel
open={detailsOpen}
setOpen={(open) => {
if (!open) setSelectedTaskId(null);
}}
>
<Title>
<div className="flex items-center px-4 h-14 border-b">
<div className="flex items-center flex-1">
Expand Down Expand Up @@ -372,7 +382,7 @@ export const TaskItem = ({
"Error while copying, please try again.",
},
);
setDetailsOpen(false);
setSelectedTaskId(null);
}}
>
<button
Expand Down
7 changes: 5 additions & 2 deletions components/project/tasklist/tasklist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ export const TaskListItem = ({
hideHeader = false,
compact = false,
canEdit = true,
showDeleted,
onShowDeletedChange,
}: {
id: number;
hideHeader?: boolean;
compact?: boolean;
canEdit?: boolean;
showDeleted?: boolean;
onShowDeletedChange?: (showDeleted: boolean) => void;
}) => {
const trpc = useTRPC();
const { data: taskList, isLoading } = useQuery(
Expand Down Expand Up @@ -63,7 +67,6 @@ export const TaskListItem = ({
[taskList?.tasks],
);

const [showDeleted, setShowDeleted] = useState(false);
const deletedItems = useMemo(
() =>
taskList?.tasks.filter((task) => task.status === TaskStatus.DELETED) ??
Expand Down Expand Up @@ -204,7 +207,7 @@ export const TaskListItem = ({
<Button
variant="ghost"
size="sm"
onClick={() => setShowDeleted((x) => !x)}
onClick={() => onShowDeletedChange?.(!showDeleted)}
>
{showDeleted ? "Hide" : "Show"}
</Button>
Expand Down
5 changes: 3 additions & 2 deletions lib/utils/mentionNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ interface MentionContext {
type: "project" | "task" | "tasklist" | "event" | "comment" | "post";
entityName: string;
entityId: number;
projectId?: number; // For linking back to project
projectId?: number;
taskListId?: number;
orgSlug: string;
fromUserId: string;
}
Expand Down Expand Up @@ -47,7 +48,7 @@ export async function sendMentionNotifications(

case "task":
message = `${fromUserName} mentioned you in task "${context.entityName}"`;
target = `/${context.orgSlug}/projects/${context.projectId}`;
target = `/${context.orgSlug}/projects/${context.projectId}/tasklists/${context.taskListId}?task=${context.entityId}`;
break;

case "tasklist":
Expand Down
17 changes: 17 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ module.exports = {
"2xl": "1400px",
},
},
fontFamily: {
sans: [
"system-ui",
"-apple-system",
"BlinkMacSystemFont",
"Segoe UI",
"Roboto",
"Helvetica Neue",
"Arial",
"Noto Sans",
"sans-serif",
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
"Noto Color Emoji",
],
},
extend: {
colors: {
gray: "neutral",
Expand Down
2 changes: 2 additions & 0 deletions trpc/routers/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export const tasksRouter = createTRPCRouter({
entityName: input.name || "Untitled Task",
entityId: createdTask[0].id,
projectId: taskListDetails.projectId,
taskListId: input.taskListId,
orgSlug: ctx.orgSlug,
fromUserId: ctx.userId,
});
Expand Down Expand Up @@ -447,6 +448,7 @@ export const tasksRouter = createTRPCRouter({
entityName: oldTask.name,
entityId: input.id,
projectId: oldTask.taskList.projectId,
taskListId: oldTask.taskListId,
orgSlug: ctx.orgSlug,
fromUserId: ctx.userId,
});
Expand Down