Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat: improve github integration, fix invitation bugs, move to otp, email templates improvements

Andrej Acevskiab2628688e07
diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.ts
index 4f5513202..13bad8f1a 100644
--- a/apps/api/src/auth.ts
+++ b/apps/api/src/auth.ts
@@ -1,11 +1,17 @@
-import { sendMagicLinkEmail, sendWorkspaceInvitationEmail } from "@kaneo/email";
+import {
+ sendMagicLinkEmail,
+ sendOtpEmail,
+ sendWorkspaceInvitationEmail,
+} from "@kaneo/email";
import bcrypt from "bcrypt";
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
+import { APIError } from "better-auth/api";
import {
anonymous,
apiKey,
createAuthMiddleware,
+ emailOTP,
genericOAuth,
lastLoginMethod,
magicLink,
@@ -15,6 +21,7 @@ import { config } from "dotenv-mono";
import { eq } from "drizzle-orm";
import db, { schema } from "./database";
import { publishEvent } from "./events";
+import { checkRegistrationAllowed } from "./utils/check-registration-allowed";
import { generateDemoName } from "./utils/generate-demo-name";
config();
@@ -130,6 +137,13 @@ export const auth = betterAuth({
}
},
}),
+ emailOTP({
+ async sendVerificationOTP({ email, otp, type }) {
+ if (type === "sign-in") {
+ await sendOtpEmail(email, "Your Kaneo verification code", { otp });
+ }
+ },
+ }),
organization({
// creatorRole: "admin", // maybe will want this "The role of the user who creates the organization."
// invitationLimit and other fields like this may be beneficial as well
@@ -182,7 +196,7 @@ export const auth = betterAuth({
},
},
async sendInvitationEmail(data) {
- const inviteLink = `${process.env.KANEO_CLIENT_URL}/auth/accept-invitation/${data.id}`;
+ const inviteLink = `${process.env.KANEO_CLIENT_URL}/invitation/accept/${data.id}`;
const result = await sendWorkspaceInvitationEmail(
data.email,
@@ -233,7 +247,55 @@ export const auth = betterAuth({
maxAge: 5 * 60,
},
},
+ databaseHooks: {
+ user: {
+ create: {
+ before: async (user) => {
+ const result = await checkRegistrationAllowed(user.email);
+ if (!result.allowed) {
+ throw new APIError("FORBIDDEN", {
+ message: result.reason,
+ });
+ }
+ },
+ },
+ },
+ },
hooks: {
+ before: createAuthMiddleware(async (ctx) => {
+ const isSignUpPath =
+ ctx.path === "/sign-up/email" ||
+ ctx.path.startsWith("/callback/") ||
+ ctx.path.startsWith("/sign-in/social");
+
+ if (!isSignUpPath) {
+ return;
+ }
+
+ const isRegistrationDisabled =
+ process.env.DISABLE_REGISTRATION === "true";
+ if (!isRegistrationDisabled) {
+ return;
+ }
+
+ const email =
+ ctx.body?.email ||
+ ctx.query?.email ||
+ ctx.headers?.get("x-invitation-email");
+ const invitationId =
+ ctx.body?.invitationId ||
+ ctx.query?.invitationId ||
+ ctx.headers?.get("x-invitation-id");
+
+ if (ctx.path === "/sign-up/email") {
+ const result = await checkRegistrationAllowed(email, invitationId);
+ if (!result.allowed) {
+ throw new APIError("FORBIDDEN", {
+ message: result.reason,
+ });
+ }
+ }
+ }),
after: createAuthMiddleware(async (ctx) => {
if (ctx.path.startsWith("/sign-up") || ctx.path.startsWith("/sign-in")) {
const newSession = ctx.context.newSession;
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 78cb502db..d607c8fb1 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -22,6 +22,7 @@ import { getPublicProject } from "./project/controllers/get-public-project";
import search from "./search";
import task from "./task";
import timeEntry from "./time-entry";
+import { getInvitationDetails } from "./utils/check-registration-allowed";
import { migrateSessionColumn } from "./utils/migrate-session-column";
import { migrateWorkspaceUserEmail } from "./utils/migrate-workspace-user-email";
import { verifyApiKey } from "./utils/verify-api-key";
@@ -85,6 +86,12 @@ api.get("/public-project/:id", async (c) => {
api.post("/github-integration/webhook", handleGithubWebhookRoute);
+const intvitationApi = api.get("/invitation/:id", async (c) => {
+ const { id } = c.req.param();
+ const result = await getInvitationDetails(id);
+ return c.json(result);
+});
+
const configApi = api.route("/config", config);
api.get(
@@ -221,6 +228,7 @@ export type AppType =
| typeof notificationApi
| typeof searchApi
| typeof githubIntegrationApi
- | typeof externalLinkApi;
+ | typeof externalLinkApi
+ | typeof intvitationApi;
export default app;
diff --git a/apps/api/src/task/controllers/get-tasks.ts b/apps/api/src/task/controllers/get-tasks.ts
index 57fb0912e..d42a6e8d3 100644
--- a/apps/api/src/task/controllers/get-tasks.ts
+++ b/apps/api/src/task/controllers/get-tasks.ts
@@ -1,7 +1,13 @@
-import { eq } from "drizzle-orm";
+import { eq, inArray } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
-import { projectTable, taskTable, userTable } from "../../database/schema";
+import {
+ externalLinkTable,
+ labelTable,
+ projectTable,
+ taskTable,
+ userTable,
+} from "../../database/schema";
const DEFAULT_COLUMNS = [
{ id: "to-do", name: "To Do" },
@@ -35,6 +41,7 @@ async function getTasks(projectId: string) {
userId: taskTable.userId,
assigneeName: userTable.name,
assigneeId: userTable.id,
+ assigneeImage: userTable.image,
projectId: taskTable.projectId,
})
.from(taskTable)
@@ -43,6 +50,59 @@ async function getTasks(projectId: string) {
.where(eq(taskTable.projectId, projectId))
.orderBy(taskTable.position);
+ const taskIds = tasks.map((task) => task.id);
+
+ const labelsData =
+ taskIds.length > 0
+ ? await db
+ .select({
+ id: labelTable.id,
+ name: labelTable.name,
+ color: labelTable.color,
+ taskId: labelTable.taskId,
+ })
+ .from(labelTable)
+ .where(inArray(labelTable.taskId, taskIds))
+ : [];
+
+ const externalLinksData =
+ taskIds.length > 0
+ ? await db
+ .select()
+ .from(externalLinkTable)
+ .where(inArray(externalLinkTable.taskId, taskIds))
+ : [];
+
+ const taskLabelsMap = new Map<
+ string,
+ Array<{ id: string; name: string; color: string }>
+ >();
+ for (const label of labelsData) {
+ if (label.taskId) {
+ if (!taskLabelsMap.has(label.taskId)) {
+ taskLabelsMap.set(label.taskId, []);
+ }
+ taskLabelsMap.get(label.taskId)?.push({
+ id: label.id,
+ name: label.name,
+ color: label.color,
+ });
+ }
+ }
+
+ const taskExternalLinksMap = new Map<string, Array<any>>();
+ for (const externalLink of externalLinksData) {
+ if (!taskExternalLinksMap.has(externalLink.taskId)) {
+ taskExternalLinksMap.set(externalLink.taskId, []);
+ }
+ taskExternalLinksMap.get(externalLink.taskId)?.push({
+ ...externalLink,
+ metadata: externalLink.metadata
+ ? JSON.parse(externalLink.metadata)
+ : null,
+ });
+ }
+
const columns = DEFAULT_COLUMNS.map((column) => ({
id: column.id,
name: column.name,
@@ -50,11 +110,26 @@ async function getTasks(projectId: string) {
.filter((task) => task.status === column.id)
.map((task) => ({
...task,
+ labels: taskLabelsMap.get(task.id) || [],
+ externalLinks: taskExternalLinksMap.get(task.id) || [],
})),
}));
- const archivedTasks = tasks.filter((task) => task.status === "archived");
- const plannedTasks = tasks.filter((task) => task.status === "planned");
+ const archivedTasks = tasks
+ .filter((task) => task.status === "archived")
+ .map((task) => ({
+ ...task,
+ labels: taskLabelsMap.get(task.id) || [],
+ externalLinks: taskExternalLinksMap.get(task.id) || [],
+ }));
+
+ const plannedTasks = tasks
+ .filter((task) => task.status === "planned")
+ .map((task) => ({
+ ...task,
+ labels: taskLabelsMap.get(task.id) || [],
+ externalLinks: taskExternalLinksMap.get(task.id) || [],
+ }));
return {
id: project.id,
diff --git a/apps/api/src/utils/check-registration-allowed.ts b/apps/api/src/utils/check-registration-allowed.ts
new file mode 100644
index 000000000..29ec34615
--- /dev/null
+++ b/apps/api/src/utils/check-registration-allowed.ts
@@ -0,0 +1,194 @@
+import { and, eq, gt } from "drizzle-orm";
+import db from "../database";
+import { invitationTable, userTable, workspaceTable } from "../database/schema";
+
+type RegistrationCheckResult = {
+ allowed: boolean;
+ reason: string;
+ invitation?: {
+ id: string;
+ email: string;
+ workspaceId: string;
+ workspaceName: string;
+ inviterName: string;
+ expiresAt: Date;
+ status: string;
+ };
+};
+
+export async function checkRegistrationAllowed(
+ email?: string,
+ invitationId?: string,
+): Promise<RegistrationCheckResult> {
+ const isRegistrationDisabled = process.env.DISABLE_REGISTRATION === "true";
+
+ if (!isRegistrationDisabled) {
+ return {
+ allowed: true,
+ reason: "Registration is enabled",
+ };
+ }
+
+ if (!invitationId && !email) {
+ return {
+ allowed: false,
+ reason:
+ "Registration is currently disabled. Please contact your administrator for an invitation.",
+ };
+ }
+
+ const invitation = await findValidInvitation(email, invitationId);
+
+ if (!invitation) {
+ return {
+ allowed: false,
+ reason:
+ "Registration is currently disabled. You need a valid invitation to create an account.",
+ };
+ }
+
+ return {
+ allowed: true,
+ reason: "Valid invitation found",
+ invitation,
+ };
+}
+
+async function findValidInvitation(
+ email?: string,
+ invitationId?: string,
+): Promise<RegistrationCheckResult["invitation"] | null> {
+ const now = new Date();
+
+ const conditions = [
+ eq(invitationTable.status, "pending"),
+ gt(invitationTable.expiresAt, now),
+ ];
+
+ if (invitationId) {
+ conditions.push(eq(invitationTable.id, invitationId));
+ }
+
+ if (email) {
+ conditions.push(eq(invitationTable.email, email.toLowerCase()));
+ }
+
+ if (!invitationId && !email) {
+ return null;
+ }
+
+ const result = await db
+ .select({
+ id: invitationTable.id,
+ email: invitationTable.email,
+ workspaceId: invitationTable.workspaceId,
+ workspaceName: workspaceTable.name,
+ inviterName: userTable.name,
+ expiresAt: invitationTable.expiresAt,
+ status: invitationTable.status,
+ })
+ .from(invitationTable)
+ .innerJoin(
+ workspaceTable,
+ eq(invitationTable.workspaceId, workspaceTable.id),
+ )
+ .innerJoin(userTable, eq(invitationTable.inviterId, userTable.id))
+ .where(and(...conditions))
+ .limit(1);
+
+ const row = result[0];
+ if (!row) {
+ return null;
+ }
+
+ return row;
+}
+
+type InvitationDetails = {
+ id: string;
+ email: string;
+ workspaceName: string;
+ inviterName: string;
+ expiresAt: Date;
+ status: string;
+ expired: boolean;
+};
+
+type InvitationDetailsResult = {
+ valid: boolean;
+ invitation?: InvitationDetails;
+ error?: string;
+};
+
+export async function getInvitationDetails(
+ invitationId: string,
+): Promise<InvitationDetailsResult> {
+ const now = new Date();
+
+ const result = await db
+ .select({
+ id: invitationTable.id,
+ email: invitationTable.email,
+ workspaceName: workspaceTable.name,
+ inviterName: userTable.name,
+ expiresAt: invitationTable.expiresAt,
+ status: invitationTable.status,
+ })
+ .from(invitationTable)
+ .innerJoin(
+ workspaceTable,
+ eq(invitationTable.workspaceId, workspaceTable.id),
+ )
+ .innerJoin(userTable, eq(invitationTable.inviterId, userTable.id))
+ .where(eq(invitationTable.id, invitationId))
+ .limit(1);
+
+ const row = result[0];
+ if (!row) {
+ return {
+ valid: false,
+ error: "Invitation not found",
+ };
+ }
+
+ const expired = row.expiresAt < now;
+ const isAccepted = row.status === "accepted";
+ const isCanceled = row.status === "canceled";
+
+ const baseInvitation: InvitationDetails = {
+ id: row.id,
+ email: row.email,
+ workspaceName: row.workspaceName,
+ inviterName: row.inviterName,
+ expiresAt: row.expiresAt,
+ status: row.status,
+ expired,
+ };
+
+ if (isAccepted) {
+ return {
+ valid: false,
+ error: "This invitation has already been accepted",
+ };
+ }
+
+ if (isCanceled) {
+ return {
+ valid: false,
+ error: "This invitation has been canceled",
+ };
+ }
+
+ if (expired) {
+ return {
+ valid: false,
+ invitation: baseInvitation,
+ error: "This invitation has expired",
+ };
+ }
+
+ return {
+ valid: true,
+ invitation: baseInvitation,
+ };
+}
diff --git a/apps/docs/content/docs/core/installation/environment-variables.mdx b/apps/docs/content/docs/core/installation/environment-variables.mdx
index 484d5d827..2dd5d60d2 100644
--- a/apps/docs/content/docs/core/installation/environment-variables.mdx
+++ b/apps/docs/content/docs/core/installation/environment-variables.mdx
@@ -58,7 +58,7 @@ Name | Description |
Name | Description | Default |
--- | --- | --- |
| `DISABLE_GUEST_ACCESS` | Disable anonymous/guest sign-in. When set to `true`, the guest access button will not be shown on sign-in and sign-up pages. | `false` |
-| `DISABLE_REGISTRATION` | Disable user registration. When set to `true`, the sign-up option will not be shown on the sign-in page. | `false` |
+| `DISABLE_REGISTRATION` | Disable public user registration. When set to `true`, the sign-up option will not be shown on the sign-in page and new user creation is blocked (including via SSO). **Note:** Users with valid workspace invitations can still register even when this is enabled. | `false` |
### GitHub SSO & Integration
diff --git a/apps/web/package.json b/apps/web/package.json
index ea03efe1a..daf7dad64 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -59,6 +59,7 @@
"react-day-picker": "9.13.0",
"react-dom": "^19.2.0",
"react-hook-form": "^7.70.0",
+ "react-markdown": "^10.1.0",
"react-use-websocket": "^4.11.1",
"sonner": "^2.0.6",
"tailwind-animate": "^0.2.10",
diff --git a/apps/web/src/components/activity/index.tsx b/apps/web/src/components/activity/index.tsx
index 41a4fcdfb..3556f35d4 100644
--- a/apps/web/src/components/activity/index.tsx
+++ b/apps/web/src/components/activity/index.tsx
@@ -125,41 +125,43 @@ function Activity({
</div>
</div>
- <div className="flex-1 min-w-0 flex items-center gap-2 pt-0.5">
- <HoverCard>
- <HoverCardTrigger asChild>
- <span className="text-sm font-medium text-foreground hover:text-primary cursor-pointer transition-colors">
- {user?.user?.name}
- </span>
- </HoverCardTrigger>
- <HoverCardContent className="w-52 p-3">
- <div className="flex items-center gap-3">
- <Avatar className="h-8 w-8">
- <AvatarImage
- src={user?.user?.image ?? ""}
- alt={user?.user?.name || ""}
- />
- <AvatarFallback className="text-xs font-medium bg-muted">
- {user?.user?.name?.charAt(0).toUpperCase()}
- </AvatarFallback>
- </Avatar>
- <div className="flex-1 min-w-0">
- <p className="text-sm font-medium text-foreground leading-none">
- {user?.user?.name}
- </p>
- <p className="text-xs text-muted-foreground mt-1">
- {user?.user?.email}
- </p>
+ <div className="flex-1 min-w-0 pt-0.5">
+ <div className="flex flex-wrap items-baseline gap-x-1.5 gap-y-0.5">
+ <HoverCard>
+ <HoverCardTrigger asChild>
+ <span className="text-sm font-medium text-foreground hover:text-primary cursor-pointer transition-colors">
+ {user?.user?.name}
+ </span>
+ </HoverCardTrigger>
+ <HoverCardContent className="w-52 p-3">
+ <div className="flex items-center gap-3">
+ <Avatar className="h-8 w-8">
+ <AvatarImage
+ src={user?.user?.image ?? ""}
+ alt={user?.user?.name || ""}
+ />
+ <AvatarFallback className="text-xs font-medium bg-muted">
+ {user?.user?.name?.charAt(0).toUpperCase()}
+ </AvatarFallback>
+ </Avatar>
+ <div className="flex-1 min-w-0">
+ <p className="text-sm font-medium text-foreground leading-none">
+ {user?.user?.name}
+ </p>
+ <p className="text-xs text-muted-foreground mt-1">
+ {user?.user?.email}
+ </p>
+ </div>
</div>
- </div>
- </HoverCardContent>
- </HoverCard>
- <span className="text-sm text-muted-foreground">
- {activity.content}
- </span>
- <span className="text-xs text-muted-foreground/60 ml-auto flex-shrink-0">
- {formatDistanceToNow(activity.createdAt, { addSuffix: true })}
- </span>
+ </HoverCardContent>
+ </HoverCard>
+ <span className="text-sm text-muted-foreground">
+ {activity.content}
+ </span>
+ <span className="text-xs text-muted-foreground/60 whitespace-nowrap">
+ {formatDistanceToNow(activity.createdAt, { addSuffix: true })}
+ </span>
+ </div>
</div>
</div>
);
diff --git a/apps/web/src/components/auth/magic-link-sign-in-form.tsx b/apps/web/src/components/auth/magic-link-sign-in-form.tsx
deleted file mode 100644
index b265a2b03..000000000
--- a/apps/web/src/components/auth/magic-link-sign-in-form.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
-import { useNavigate } from "@tanstack/react-router";
-import { useState } from "react";
-import { useForm } from "react-hook-form";
-import { toast } from "sonner";
-import { z } from "zod/v4";
-import { Button } from "@/components/ui/button";
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from "@/components/ui/form";
-import { Input } from "@/components/ui/input";
-import { authClient } from "@/lib/auth-client";
-
-export type MagicLinkSignInFormValues = {
- email: string;
-};
-
-const magicLinkSchema = z.object({
- email: z.email(),
-});
-
-export function MagicLinkSignInForm() {
- const [isPending, setIsPending] = useState(false);
- const navigate = useNavigate();
- const form = useForm<MagicLinkSignInFormValues>({
- resolver: standardSchemaResolver(magicLinkSchema),
- defaultValues: {
- email: "",
- },
- });
-
- const onSubmit = async (data: MagicLinkSignInFormValues) => {
- setIsPending(true);
- try {
- const result = await authClient.signIn.magicLink({
- email: data.email,
- callbackURL: `${import.meta.env.VITE_CLIENT_URL}/profile-setup`,
- });
-
- if (result.error) {
- toast.error(result.error.message || "Failed to send magic link");
- return;
- }
-
- toast.success("Magic link sent! Check your email to sign in.");
- navigate({
- to: "/auth/check-email",
- search: { email: data.email },
- });
- } catch (error) {
- toast.error(
- error instanceof Error ? error.message : "Failed to send magic link",
- );
- } finally {
- setIsPending(false);
- }
- };
-
- return (
- <Form {...form}>
- <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-3">
- <div className="space-y-3">
- <FormField
- control={form.control}
- name="email"
- render={({ field, fieldState }) => (
- <FormItem>
- <FormLabel className="text-sm font-medium">Email</FormLabel>
- <FormControl>
- <Input
- placeholder="[email protected]"
- type="email"
- autoComplete="email"
- {...field}
- />
- </FormControl>
- <FormMessage>{fieldState.error?.message}</FormMessage>
- </FormItem>
- )}
- />
- </div>
-
- <Button
- type="submit"
- disabled={isPending}
- className="w-full mt-4 text-white"
- >
- {isPending ? "Sending..." : "Send Magic Link"}
- </Button>
- </form>
- </Form>
- );
-}
diff --git a/apps/web/src/components/auth/otp-sign-in-form.tsx b/apps/web/src/components/auth/otp-sign-in-form.tsx
new file mode 100644
index 000000000..b0dd3aa19
--- /dev/null
+++ b/apps/web/src/components/auth/otp-sign-in-form.tsx
@@ -0,0 +1,101 @@
+import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
+import { useRouter } from "@tanstack/react-router";
+import { useState } from "react";
+import { useForm } from "react-hook-form";
+import { toast } from "sonner";
+import { z } from "zod/v4";
+import { Button } from "@/components/ui/button";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { Input } from "@/components/ui/input";
+import { authClient } from "@/lib/auth-client";
+
+type OtpSignInFormProps = {
+ invitationId?: string;
+ onSuccess?: () => void;
+};
+
+const emailSchema = z.object({
+ email: z.email(),
+});
+
+type EmailFormValues = z.infer<typeof emailSchema>;
+
+export function OtpSignInForm({ invitationId, onSuccess }: OtpSignInFormProps) {
+ const [isPending, setIsPending] = useState(false);
+ const { history } = useRouter();
+
+ const form = useForm<EmailFormValues>({
+ resolver: standardSchemaResolver(emailSchema),
+ defaultValues: { email: "" },
+ });
+
+ const onSubmit = async (data: EmailFormValues) => {
+ setIsPending(true);
+ try {
+ const result = await authClient.emailOtp.sendVerificationOtp({
+ email: data.email,
+ type: "sign-in",
+ });
+
+ if (result.error) {
+ toast.error(result.error.message || "Failed to send verification code");
+ return;
+ }
+
+ toast.success("Verification code sent! Check your email.");
+ const searchParams = new URLSearchParams({
+ email: data.email,
+ ...(invitationId && { invitationId }),
+ });
+ history.push(`/auth/verify-otp?${searchParams.toString()}`);
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : "Failed to send verification code",
+ );
+ } finally {
+ setIsPending(false);
+ }
+ };
+
+ return (
+ <Form {...form}>
+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-3">
+ <FormField
+ control={form.control}
+ name="email"
+ render={({ field, fieldState }) => (
+ <FormItem>
+ <FormLabel className="text-sm font-medium">Email</FormLabel>
+ <FormControl>
+ <Input
+ placeholder="[email protected]"
+ type="email"
+ autoComplete="email"
+ {...field}
+ />
+ </FormControl>
+ <FormMessage>{fieldState.error?.message}</FormMessage>
+ </FormItem>
+ )}
+ />
+
+ <Button
+ type="submit"
+ disabled={isPending}
+ className="w-full mt-4 text-white"
+ >
+ {isPending ? "Sending..." : "Send Verification Code"}
+ </Button>
+ </form>
+ </Form>
+ );
+}
diff --git a/apps/web/src/components/auth/sign-in-form.tsx b/apps/web/src/components/auth/sign-in-form.tsx
index cb2405ded..bf4a2910a 100644
--- a/apps/web/src/components/auth/sign-in-form.tsx
+++ b/apps/web/src/components/auth/sign-in-form.tsx
@@ -1,5 +1,4 @@
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
-import { useRouter } from "@tanstack/react-router";
import { Eye, EyeOff } from "lucide-react";
import { useState } from "react";
import { useForm } from "react-hook-form";
@@ -22,15 +21,18 @@ export type SignInFormValues = {
password: string;
};
+type SignInFormProps = {
+ onSuccess?: () => void;
+};
+
const signInSchema = z.object({
email: z.email(),
password: z.string(),
});
-export function SignInForm() {
+export function SignInForm({ onSuccess }: SignInFormProps) {
const [showPassword, setShowPassword] = useState(false);
const [isPending, setIsPending] = useState(false);
- const { history } = useRouter();
const form = useForm<SignInFormValues>({
resolver: standardSchemaResolver(signInSchema),
defaultValues: {
@@ -54,7 +56,7 @@ export function SignInForm() {
toast.success("Signed in successfully");
setTimeout(() => {
- history.push("/dashboard");
+ onSuccess?.();
}, 500);
} catch (error) {
toast.error(error instanceof Error ? error.message : "Failed to sign in");
diff --git a/apps/web/src/components/auth/sign-up-form.tsx b/apps/web/src/components/auth/sign-up-form.tsx
index 3e7a22a70..2844eba73 100644
--- a/apps/web/src/components/auth/sign-up-form.tsx
+++ b/apps/web/src/components/auth/sign-up-form.tsx
@@ -23,20 +23,25 @@ export type SignUpFormValues = {
name: string;
};
+type SignUpFormProps = {
+ invitationId?: string;
+ defaultEmail?: string;
+};
+
const signUpSchema = z.object({
email: z.email(),
password: z.string().min(8, { message: "Password is too short" }),
name: z.string(),
});
-export function SignUpForm() {
+export function SignUpForm({ invitationId, defaultEmail }: SignUpFormProps) {
const [showPassword, setShowPassword] = useState(false);
const [isPending, setIsPending] = useState(false);
const { history } = useRouter();
const form = useForm<SignUpFormValues>({
resolver: standardSchemaResolver(signUpSchema),
defaultValues: {
- email: "",
+ email: defaultEmail || "",
password: "",
name: "",
},
@@ -57,9 +62,12 @@ export function SignUpForm() {
}
toast.success("Account created successfully");
- setTimeout(() => {
+
+ if (invitationId) {
+ history.push(`/invitation/accept/${invitationId}`);
+ } else {
history.push("/dashboard");
- }, 500);
+ }
} catch (error) {
toast.error(error instanceof Error ? error.message : "Failed to sign up");
} finally {
@@ -101,6 +109,7 @@ export function SignUpForm() {
placeholder="[email protected]"
type="email"
autoComplete="email"
+ disabled={!!defaultEmail}
{...field}
/>
</FormControl>
diff --git a/apps/web/src/components/backlog-list-view/backlog-task-row.tsx b/apps/web/src/components/backlog-list-view/backlog-task-row.tsx
index 87bafaba3..1086b7616 100644
--- a/apps/web/src/components/backlog-list-view/backlog-task-row.tsx
+++ b/apps/web/src/components/backlog-list-view/backlog-task-row.tsx
@@ -87,14 +87,20 @@ export default function BacklogTaskRow({ task }: BacklogTaskRowProps) {
return;
}
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
- params: {
- workspaceId: project.workspaceId,
- projectId: project.id,
- taskId: task.id,
- },
- });
+ const currentParams = new URLSearchParams(window.location.search);
+ const currentTaskId = currentParams.get("taskId");
+
+ if (currentTaskId === task.id) {
+ navigate({
+ to: ".",
+ search: {},
+ });
+ } else {
+ navigate({
+ to: ".",
+ search: { taskId: task.id },
+ });
+ }
};
const handleKeyDown = (e: React.KeyboardEvent) => {
diff --git a/apps/web/src/components/common/task-layout.tsx b/apps/web/src/components/common/task-layout.tsx
index 1c9e16dc9..b0411b66b 100644
--- a/apps/web/src/components/common/task-layout.tsx
+++ b/apps/web/src/components/common/task-layout.tsx
@@ -43,15 +43,15 @@ export default function TaskLayout({
const { data: task } = useGetTask(taskId);
return (
- <Layout className="flex flex-row">
- <div className="flex-1">
+ <Layout className="flex flex-col lg:flex-row">
+ <div className="flex-1 flex flex-col min-w-0">
<Layout.Header className="sticky top-0 z-10">
<div className="flex items-center justify-between w-full">
- <div className="flex items-center gap-1 w-full">
+ <div className="flex items-center gap-1 w-full min-w-0">
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
- <SidebarTrigger className="-ml-1 h-6 w-6 cursor-pointer text-muted-foreground" />
+ <SidebarTrigger className="-ml-1 h-6 w-6 cursor-pointer text-muted-foreground shrink-0" />
</TooltipTrigger>
<TooltipContent>
<p className="flex items-center gap-2 text-[10px]">
@@ -68,48 +68,51 @@ export default function TaskLayout({
</TooltipProvider>
<Separator
orientation="vertical"
- className="mx-1.5 data-[orientation=vertical]:h-2.5"
+ className="mx-1.5 data-[orientation=vertical]:h-2.5 shrink-0"
/>
- <Breadcrumb className="flex items-center text-xs w-full">
- <BreadcrumbList className="!gap-1">
- <BreadcrumbItem>
+ <Breadcrumb className="flex items-center text-xs w-full min-w-0">
+ <BreadcrumbList className="!gap-1 flex-wrap">
+ <BreadcrumbItem className="hidden sm:inline-flex">
<BreadcrumbLink
href={`/dashboard/workspace/${workspaceId}`}
>
- <h1 className="text-xs text-muted-foreground">
+ <span className="text-xs text-muted-foreground truncate max-w-[100px]">
{workspace?.name}
- </h1>
+ </span>
</BreadcrumbLink>
</BreadcrumbItem>
- <BreadcrumbSeparator />
- <BreadcrumbItem>
+ <BreadcrumbSeparator className="hidden sm:inline-flex" />
+ <BreadcrumbItem className="hidden md:inline-flex">
<BreadcrumbLink
href={`/dashboard/workspace/${workspaceId}/project/${projectId}/board`}
>
- <h1 className="text-xs text-muted-foreground">
+ <span className="text-xs text-muted-foreground truncate max-w-[100px]">
{project?.name}
- </h1>
+ </span>
</BreadcrumbLink>
</BreadcrumbItem>
- <BreadcrumbSeparator />
+ <BreadcrumbSeparator className="hidden md:inline-flex" />
<BreadcrumbItem>
- <h1 className="text-xs text-muted-foreground">
+ <span className="text-xs text-muted-foreground">
{project?.slug}-{task?.number}
- </h1>
+ </span>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
</div>
- <div className="flex items-center gap-1.5">{headerActions}</div>
+ <div className="flex items-center gap-1.5 shrink-0">
+ {headerActions}
+ </div>
</div>
</Layout.Header>
<Layout.Content>
- <div className="flex h-full">
- <div className="flex-1 min-w-0">{children}</div>
+ <div className="flex flex-col lg:flex-row h-full">
+ <div className="order-2 lg:order-1 flex-1 min-w-0">{children}</div>
+ <div className="order-1 lg:order-2 lg:hidden">{rightSidebar}</div>
</div>
</Layout.Content>
</div>
- {rightSidebar}
+ <div className="hidden lg:flex lg:h-full">{rightSidebar}</div>
</Layout>
);
}
diff --git a/apps/web/src/components/kanban-board/task-card.tsx b/apps/web/src/components/kanban-board/task-card.tsx
index 96175cd3b..97252f4e0 100644
--- a/apps/web/src/components/kanban-board/task-card.tsx
+++ b/apps/web/src/components/kanban-board/task-card.tsx
@@ -132,14 +132,20 @@ function TaskCard({ task }: TaskCardProps) {
return;
}
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
- params: {
- workspaceId: workspace.id,
- projectId: project.id,
- taskId: task.id,
- },
- });
+ const currentParams = new URLSearchParams(window.location.search);
+ const currentTaskId = currentParams.get("taskId");
+
+ if (currentTaskId === task.id) {
+ navigate({
+ to: ".",
+ search: {},
+ });
+ } else {
+ navigate({
+ to: ".",
+ search: { taskId: task.id },
+ });
+ }
}
const handleKeyDown = (e: React.KeyboardEvent) => {
@@ -150,7 +156,6 @@ function TaskCard({ task }: TaskCardProps) {
const handleDeleteTask = async () => {
try {
- await deleteTask(task.id);
queryClient.invalidateQueries({
queryKey: ["tasks", project?.id],
});
@@ -279,6 +284,7 @@ function TaskCard({ task }: TaskCardProps) {
className="w-72 p-3"
side="bottom"
onClick={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
>
<div className="space-y-2">
<div className="flex items-center gap-2 text-xs text-muted-foreground">
@@ -325,6 +331,7 @@ function TaskCard({ task }: TaskCardProps) {
className="w-auto min-w-56 max-w-96 p-1"
side="bottom"
onClick={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
>
{pullRequests.map((pr, index) => {
const prInfo = getPRInfo(pr);
diff --git a/apps/web/src/components/list-view/task-row.tsx b/apps/web/src/components/list-view/task-row.tsx
index d7125f98a..b226f7be6 100644
--- a/apps/web/src/components/list-view/task-row.tsx
+++ b/apps/web/src/components/list-view/task-row.tsx
@@ -133,14 +133,20 @@ function TaskRow({ task, projectSlug }: TaskRowProps) {
return;
}
- navigate({
- to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
- params: {
- workspaceId: project.workspaceId,
- projectId: project.id,
- taskId: task.id,
- },
- });
+ const currentParams = new URLSearchParams(window.location.search);
+ const currentTaskId = currentParams.get("taskId");
+
+ if (currentTaskId === task.id) {
+ navigate({
+ to: ".",
+ search: {},
+ });
+ } else {
+ navigate({
+ to: ".",
+ search: { taskId: task.id },
+ });
+ }
};
const handleKeyDown = (e: React.KeyboardEvent) => {
diff --git a/apps/web/src/components/public-project/copy-url-button.tsx b/apps/web/src/components/public-project/copy-url-button.tsx
index 5722938c2..827376615 100644
--- a/apps/web/src/components/public-project/copy-url-button.tsx
+++ b/apps/web/src/components/public-project/copy-url-button.tsx
@@ -1,5 +1,6 @@
import { Check, Copy } from "lucide-react";
import { useState } from "react";
+import { toast } from "sonner";
import { Button } from "@/components/ui/button";
export function CopyUrlButton() {
@@ -9,28 +10,30 @@ export function CopyUrlButton() {
try {
await navigator.clipboard.writeText(window.location.href);
setCopied(true);
+ toast.success("URL copied");
setTimeout(() => setCopied(false), 2000);
} catch (error) {
console.error("Failed to copy URL:", error);
+ toast.error("Failed to copy URL");
}
};
return (
<Button
- variant="outline"
+ variant="ghost"
size="sm"
onClick={handleCopyUrl}
- className="gap-2"
+ className="h-8 gap-2"
>
{copied ? (
<>
- <Check className="w-4 h-4" />
- Copied
+ <Check className="h-3 w-3" />
+ <span className="text-xs">Copied</span>
</>
) : (
<>
- <Copy className="w-4 h-4" />
- Copy URL
+ <Copy className="h-3 w-3" />
+ <span className="text-xs">Share</span>
</>
)}
</Button>
diff --git a/apps/web/src/components/public-project/kanban-view.tsx b/apps/web/src/components/public-project/kanban-view.tsx
index b6181de07..658e7efba 100644
--- a/apps/web/src/components/public-project/kanban-view.tsx
+++ b/apps/web/src/components/public-project/kanban-view.tsx
@@ -26,41 +26,45 @@ export function PublicKanbanView({
}));
return (
- <div className="flex-1 min-h-0 overflow-hidden">
- <div className="h-full overflow-x-auto overflow-y-hidden">
- <div className="flex gap-6 p-6 h-full min-w-max">
- {columns.map((column) => {
- const IconComponent = column.icon;
- return (
- <div
- key={column.id}
- className="w-80 flex flex-col bg-zinc-50 dark:bg-zinc-900/50 rounded-xl border border-zinc-200 dark:border-zinc-700/50 overflow-hidden flex-1"
- >
- <div className="px-4 py-3 bg-white dark:bg-zinc-800/50 border-b border-zinc-200 dark:border-zinc-700/50">
- <div className="flex items-center gap-2">
- <IconComponent className="w-4 h-4 text-zinc-500 dark:text-zinc-400" />
- <h3 className="font-semibold text-zinc-900 dark:text-zinc-100">
- {column.name}
- </h3>
- <span className="text-sm text-zinc-500 dark:text-zinc-400 bg-zinc-200 dark:bg-zinc-700 px-2 py-0.5 rounded-full font-medium">
- {column.tasks.length}
- </span>
+ <div className="flex-1 min-h-0 overflow-x-auto">
+ <div className="flex gap-3 p-3 h-full min-w-max transition-all duration-200 ease-out">
+ {columns.map((column) => {
+ const IconComponent = column.icon;
+ return (
+ <div
+ key={column.id}
+ className="h-full flex-1 min-w-80 max-w-96 flex-shrink-0"
+ >
+ <div className="flex flex-col h-full w-full min-h-0 backdrop-blur-xs rounded-lg bg-sidebar border border-border/50 transition-all duration-300 ease-out hover:bg-zinc-50/40 dark:hover:bg-zinc-900/40 hover:shadow-sm">
+ <div className="p-2 shrink-0">
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <IconComponent className="w-4 h-4 text-muted-foreground" />
+ <h3 className="font-medium text-foreground">
+ {column.name}
+ </h3>
+ <span className="text-sm text-muted-foreground">
+ {column.tasks.length}
+ </span>
+ </div>
</div>
</div>
- <div className="flex-1 p-3 space-y-3 overflow-y-auto min-h-0">
- {column.tasks.map((task) => (
- <PublicTaskCard
- key={task.id}
- task={task}
- projectSlug={project.slug}
- onTaskClick={onTaskClick}
- />
- ))}
+ <div className="p-2 overflow-y-auto overflow-x-hidden flex-1 min-h-0">
+ <div className="flex flex-col gap-1.5">
+ {column.tasks.map((task) => (
+ <PublicTaskCard
+ key={task.id}
+ task={task}
+ projectSlug={project.slug}
+ onTaskClick={onTaskClick}
+ />
+ ))}
+ </div>
{column.tasks.length === 0 && (
- <div className="text-center text-sm text-zinc-500 dark:text-zinc-400 py-12 px-4">
- <div className="w-8 h-8 rounded-full bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center mx-auto mb-2">
+ <div className="text-center text-sm text-muted-foreground py-12 px-4">
+ <div className="w-8 h-8 rounded-full bg-muted flex items-center justify-center mx-auto mb-2">
<IconComponent className="w-4 h-4" />
</div>
No tasks in {column.name.toLowerCase()}
@@ -68,9 +72,9 @@ export function PublicKanbanView({
)}
</div>
</div>
- );
- })}
- </div>
+ </div>
+ );
+ })}
</div>
</div>
);
diff --git a/apps/web/src/components/public-project/kaneo-branding.tsx b/apps/web/src/components/public-project/kaneo-branding.tsx
index 37ffba384..37421b0a4 100644
--- a/apps/web/src/components/public-project/kaneo-branding.tsx
+++ b/apps/web/src/components/public-project/kaneo-branding.tsx
@@ -1,15 +1,12 @@
-import { ArrowRight, Star } from "lucide-react";
-
export function KaneoBranding() {
return (
- <div className="flex items-center gap-2 text-sm text-zinc-500 dark:text-zinc-400">
- <span>Powered by</span>
- <div className="flex items-center gap-1 font-semibold text-indigo-600 dark:text-indigo-400">
- <Star className="w-4 h-4" />
- <span>Kaneo</span>
- </div>
- <ArrowRight className="w-3 h-3" />
- <span className="text-xs">Project Management Made Simple</span>
- </div>
+ <a
+ href="https://kaneo.app"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="hover:text-foreground transition-colors"
+ >
+ Powered by <span className="font-medium">Kaneo</span>
+ </a>
);
}
diff --git a/apps/web/src/components/public-project/list-view.tsx b/apps/web/src/components/public-project/list-view.tsx
index 6a664e3d0..6bbb88bf3 100644
--- a/apps/web/src/components/public-project/list-view.tsx
+++ b/apps/web/src/components/public-project/list-view.tsx
@@ -30,16 +30,16 @@ export function PublicListView({ project, onTaskClick }: PublicListViewProps) {
return (
<div key={column.id} className="space-y-4">
<div className="flex items-center gap-3 px-2">
- <IconComponent className="w-5 h-5 text-zinc-500 dark:text-zinc-400" />
- <h3 className="font-semibold text-lg text-zinc-900 dark:text-zinc-100">
+ <IconComponent className="w-5 h-5 text-muted-foreground" />
+ <h3 className="font-semibold text-lg text-foreground">
{column.name}
</h3>
- <span className="text-sm text-zinc-500 dark:text-zinc-400 bg-zinc-200 dark:bg-zinc-700 px-3 py-1 rounded-full font-medium">
+ <span className="text-sm text-muted-foreground bg-muted px-3 py-1 rounded-full font-medium">
{column.tasks.length}
</span>
</div>
- <div className="space-y-3">
+ <div className="space-y-2">
{column.tasks.map((task) => (
<PublicTaskRow
key={task.id}
@@ -50,8 +50,8 @@ export function PublicListView({ project, onTaskClick }: PublicListViewProps) {
))}
{column.tasks.length === 0 && (
- <div className="text-center text-sm text-zinc-500 dark:text-zinc-400 py-8 bg-zinc-50 dark:bg-zinc-900/50 rounded-lg border border-dashed border-zinc-300 dark:border-zinc-700">
- <div className="w-8 h-8 rounded-full bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center mx-auto mb-2">
+ <div className="text-center text-sm text-muted-foreground py-8 bg-muted/50 rounded-lg border border-dashed border-border">
+ <div className="w-8 h-8 rounded-full bg-muted flex items-center justify-center mx-auto mb-2">
<IconComponent className="w-4 h-4" />
</div>
No tasks in {column.name.toLowerCase()}
diff --git a/apps/web/src/components/public-project/markdown-renderer.tsx b/apps/web/src/components/public-project/markdown-renderer.tsx
new file mode 100644
index 000000000..b9d7b7c7e
--- /dev/null
+++ b/apps/web/src/components/public-project/markdown-renderer.tsx
@@ -0,0 +1,70 @@
+import ReactMarkdown from "react-markdown";
+
+type MarkdownRendererProps = {
+ content: string;
+};
+
+export function MarkdownRenderer({ content }: MarkdownRendererProps) {
+ return (
+ <ReactMarkdown
+ components={{
+ h1: ({ children, ...props }) => (
+ <h1 className="text-xl font-semibold mb-2 mt-4" {...props}>
+ {children}
+ </h1>
+ ),
+ h2: ({ children, ...props }) => (
+ <h2 className="text-lg font-semibold mb-2 mt-3" {...props}>
+ {children}
+ </h2>
+ ),
+ h3: ({ children, ...props }) => (
+ <h3 className="text-base font-semibold mb-1.5 mt-2.5" {...props}>
+ {children}
+ </h3>
+ ),
+ p: ({ children, ...props }) => (
+ <p className="mb-2 leading-relaxed" {...props}>
+ {children}
+ </p>
+ ),
+ ul: ({ children, ...props }) => (
+ <ul className="list-disc list-inside mb-2 space-y-1" {...props}>
+ {children}
+ </ul>
+ ),
+ ol: ({ children, ...props }) => (
+ <ol className="list-decimal list-inside mb-2 space-y-1" {...props}>
+ {children}
+ </ol>
+ ),
+ code: ({ children, ...props }) => (
+ <code
+ className="bg-muted px-1.5 py-0.5 rounded text-xs font-mono"
+ {...props}
+ >
+ {children}
+ </code>
+ ),
+ pre: ({ children, ...props }) => (
+ <pre
+ className="bg-muted p-3 rounded border border-border/50 overflow-x-auto mb-2"
+ {...props}
+ >
+ {children}
+ </pre>
+ ),
+ blockquote: ({ children, ...props }) => (
+ <blockquote
+ className="border-l-2 border-border pl-3 italic text-muted-foreground mb-2"
+ {...props}
+ >
+ {children}
+ </blockquote>
+ ),
+ }}
+ >
+ {content}
+ </ReactMarkdown>
+ );
+}
diff --git a/apps/web/src/components/public-project/public-pr-badge.tsx b/apps/web/src/components/public-project/public-pr-badge.tsx
new file mode 100644
index 000000000..cfebc45d0
--- /dev/null
+++ b/apps/web/src/components/public-project/public-pr-badge.tsx
@@ -0,0 +1,148 @@
+import { GitMerge, GitPullRequest } from "lucide-react";
+import { useMemo } from "react";
+import {
+ HoverCard,
+ HoverCardContent,
+ HoverCardTrigger,
+} from "@/components/ui/hover-card";
+import type { ExternalLink } from "@/types/external-link";
+
+type PublicPRBadgeProps = {
+ externalLinks: ExternalLink[];
+};
+
+export function PublicPRBadge({ externalLinks }: PublicPRBadgeProps) {
+ const pullRequests = useMemo(() => {
+ if (!externalLinks) return [];
+ return externalLinks.filter((link) => link.resourceType === "pull_request");
+ }, [externalLinks]);
+
+ if (pullRequests.length === 0) return null;
+
+ const getPRInfo = (pr: (typeof pullRequests)[number]) => {
+ const isMerged = pr.metadata?.merged === true;
+ const isDraft = pr.metadata?.draft === true;
+
+ if (isMerged) {
+ return {
+ icon: <GitMerge className="h-3 w-3 text-purple-400" />,
+ status: "Merged",
+ statusClass: "text-purple-400",
+ };
+ }
+
+ if (isDraft) {
+ return {
+ icon: <GitPullRequest className="h-3 w-3 text-muted-foreground" />,
+ status: "Draft",
+ statusClass: "text-muted-foreground",
+ };
+ }
+
+ return {
+ icon: <GitPullRequest className="h-3 w-3 text-green-400" />,
+ status: "Open",
+ statusClass: "text-green-400",
+ };
+ };
+
+ if (pullRequests.length === 1) {
+ return (
+ <HoverCard openDelay={200} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ window.open(pullRequests[0].url, "_blank");
+ }}
+ className="inline-flex items-center gap-1.5 px-2 py-1 rounded border border-border bg-sidebar text-[10px] font-medium text-muted-foreground hover:bg-muted/50 transition-colors"
+ >
+ {getPRInfo(pullRequests[0]).icon}
+ <span>#{pullRequests[0].externalId}</span>
+ </button>
+ </HoverCardTrigger>
+ <HoverCardContent
+ className="w-72 p-3"
+ side="bottom"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <div className="space-y-2">
+ <div className="flex items-center gap-2 text-xs text-muted-foreground">
+ {getPRInfo(pullRequests[0]).icon}
+ <span>{getPRInfo(pullRequests[0]).status}</span>
+ <span className="text-muted-foreground/50">•</span>
+ <span>#{pullRequests[0].externalId}</span>
+ </div>
+ <p className="text-sm font-medium leading-snug">
+ {pullRequests[0].title || "Pull Request"}
+ </p>
+ </div>
+ </HoverCardContent>
+ </HoverCard>
+ );
+ }
+
+ if (pullRequests.length > 1) {
+ const hasOpen = pullRequests.some(
+ (pr) => !pr.metadata?.merged && !pr.metadata?.draft,
+ );
+ const allMerged = pullRequests.every((pr) => pr.metadata?.merged);
+ const iconColor = allMerged
+ ? "text-purple-400"
+ : hasOpen
+ ? "text-green-400"
+ : "text-muted-foreground";
+
+ return (
+ <HoverCard openDelay={200} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <button
+ type="button"
+ onClick={(e) => e.stopPropagation()}
+ className="inline-flex items-center gap-1.5 px-2 py-1 rounded border border-border bg-sidebar text-[10px] font-medium text-muted-foreground hover:bg-muted/50 transition-colors"
+ >
+ <GitPullRequest className={`h-3 w-3 ${iconColor}`} />
+ <span>{pullRequests.length} PRs</span>
+ </button>
+ </HoverCardTrigger>
+ <HoverCardContent
+ className="w-auto min-w-56 max-w-96 p-1"
+ side="bottom"
+ onClick={(e) => e.stopPropagation()}
+ >
+ {pullRequests.map((pr, index) => {
+ const prInfo = getPRInfo(pr);
+ const repoMatch = pr.url.match(/github\.com\/([^/]+\/[^/]+)\/pull/);
+ const repoName = repoMatch ? repoMatch[1] : null;
+ return (
+ <div key={pr.id}>
+ {index > 0 && <hr className="border-border my-1" />}
+ <button
+ type="button"
+ onClick={() => window.open(pr.url, "_blank")}
+ className="w-full px-2 py-1.5 text-left hover:bg-muted/50 rounded transition-colors"
+ >
+ <div className="flex items-center gap-1.5 text-[11px] text-muted-foreground">
+ {prInfo.icon}
+ <span>
+ {repoName}#{pr.externalId}
+ </span>
+ </div>
+ <p className="text-xs leading-tight line-clamp-2 mt-0.5">
+ {pr.title || "Pull Request"}
+ </p>
+ <span className="text-[10px] text-muted-foreground">
+ {prInfo.status}
+ </span>
+ </button>
+ </div>
+ );
+ })}
+ </HoverCardContent>
+ </HoverCard>
+ );
+ }
+
+ return null;
+}
diff --git a/apps/web/src/components/public-project/public-task-labels.tsx b/apps/web/src/components/public-project/public-task-labels.tsx
new file mode 100644
index 000000000..abdf552f0
--- /dev/null
+++ b/apps/web/src/components/public-project/public-task-labels.tsx
@@ -0,0 +1,32 @@
+import { Badge } from "@/components/ui/badge";
+import labelColors from "@/constants/label-colors";
+
+type PublicTaskLabelsProps = {
+ labels: Array<{ id: string; name: string; color: string }>;
+};
+
+export function PublicTaskLabels({ labels }: PublicTaskLabelsProps) {
+ if (!labels || labels.length === 0) return null;
+
+ return (
+ <div className="flex flex-wrap gap-1">
+ {labels.map((label) => (
+ <Badge
+ key={label.id}
+ variant="outline"
+ className="px-2 py-0.5 text-[10px] flex items-center"
+ >
+ <span
+ className="inline-block w-1.5 h-1.5 mr-1 rounded-full"
+ style={{
+ backgroundColor:
+ labelColors.find((c) => c.value === label.color)?.color ||
+ "#94a3b8",
+ }}
+ />
+ <span className="truncate max-w-[80px]">{label.name}</span>
+ </Badge>
+ ))}
+ </div>
+ );
+}
diff --git a/apps/web/src/components/public-project/task-card.tsx b/apps/web/src/components/public-project/task-card.tsx
index cefb39437..20fa7515a 100644
--- a/apps/web/src/components/public-project/task-card.tsx
+++ b/apps/web/src/components/public-project/task-card.tsx
@@ -1,12 +1,17 @@
import { format } from "date-fns";
-import { Flag } from "lucide-react";
-import { Avatar, AvatarFallback } from "@/components/ui/avatar";
-import { priorityColorsTaskCard } from "@/constants/priority-colors";
-import { cn } from "@/lib/cn";
+import { Calendar, CalendarClock, CalendarX } from "lucide-react";
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
+import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";
+import { getPriorityIcon } from "@/lib/priority";
import type Task from "@/types/task";
+import { PublicPRBadge } from "./public-pr-badge";
+import { PublicTaskLabels } from "./public-task-labels";
type PublicTaskCardProps = {
- task: Task;
+ task: Task & {
+ labels?: Array<{ id: string; name: string; color: string }>;
+ externalLinks?: Array<any>;
+ };
projectSlug: string;
onTaskClick: (task: Task) => void;
};
@@ -16,63 +21,86 @@ export function PublicTaskCard({
projectSlug,
onTaskClick,
}: PublicTaskCardProps) {
+ const labels = task.labels || [];
+ const externalLinks = task.externalLinks || [];
+
return (
<button
type="button"
- className="w-full text-left p-4 bg-white dark:bg-zinc-800/80 rounded-lg border border-zinc-200 dark:border-zinc-700/50 shadow-sm hover:shadow-md transition-all cursor-pointer hover:border-zinc-300 dark:hover:border-zinc-600 hover:scale-[1.02] focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
+ className="group w-full text-left p-3 bg-card border border-border rounded-lg cursor-pointer transition-all duration-200 ease-out hover:border-border/70 hover:shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
onClick={() => onTaskClick(task)}
aria-label={`View details for task ${task.title}`}
>
- <div className="space-y-3">
- <div className="flex items-start justify-between gap-2">
- <div className="space-y-1 flex-1 min-w-0">
- <div className="text-xs font-mono text-zinc-500 dark:text-zinc-400">
- {projectSlug}-{task.number}
- </div>
- <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 line-clamp-2 leading-relaxed">
- {task.title}
- </h3>
- </div>
+ <div className="text-[10px] font-mono text-muted-foreground mb-2">
+ {projectSlug}-{task.number}
+ </div>
+
+ {task.assigneeName && (
+ <div className="flex items-center gap-1.5 mb-2">
+ <Avatar className="h-5 w-5">
+ <AvatarImage
+ src={task.assigneeImage ?? ""}
+ alt={task.assigneeName ?? ""}
+ />
+ <AvatarFallback className="text-[10px] font-medium border border-border/30">
+ {task.assigneeName.charAt(0).toUpperCase()}
+ </AvatarFallback>
+ </Avatar>
+ <span className="text-[10px] text-muted-foreground font-medium truncate">
+ {task.assigneeName}
+ </span>
+ </div>
+ )}
+
+ <div className="mb-3">
+ <h3
+ className="font-medium text-foreground text-sm leading-relaxed overflow-hidden break-words"
+ style={{
+ display: "-webkit-box",
+ WebkitLineClamp: 3,
+ WebkitBoxOrient: "vertical",
+ wordBreak: "break-word",
+ hyphens: "auto",
+ }}
+ >
+ {task.title}
+ </h3>
+ </div>
+
+ {labels.length > 0 && (
+ <div className="mb-3">
+ <PublicTaskLabels labels={labels} />
</div>
+ )}
- {task.description && (
- <p className="text-xs text-zinc-600 dark:text-zinc-400 line-clamp-3 leading-relaxed">
- {task.description}
- </p>
+ <div className="flex items-center gap-2">
+ {task.priority && (
+ <span className="inline-flex items-center gap-1.5 px-2 py-1 rounded border border-border bg-sidebar text-[10px] font-medium text-muted-foreground">
+ {getPriorityIcon(task.priority ?? "")}
+ </span>
)}
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- {task.priority && (
- <div
- className={cn(
- "flex items-center gap-1 text-xs px-2 py-1 rounded-full font-medium",
- priorityColorsTaskCard[
- task.priority as keyof typeof priorityColorsTaskCard
- ],
- )}
- >
- <Flag className="w-3 h-3" />
- <span className="capitalize">{task.priority}</span>
- </div>
+ {task.dueDate && (
+ <div
+ className={`flex items-center gap-1 text-[10px] px-2 py-1 rounded ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}
+ >
+ {getDueDateStatus(task.dueDate) === "overdue" && (
+ <CalendarX className="w-3 h-3" />
)}
- </div>
-
- <div className="flex items-center gap-2">
- {task.userId && (
- <Avatar className="h-6 w-6 ring-2 ring-zinc-100 dark:ring-zinc-700">
- <AvatarFallback className="text-xs font-medium">
- {task.userId.charAt(0).toUpperCase()}
- </AvatarFallback>
- </Avatar>
+ {getDueDateStatus(task.dueDate) === "due-soon" && (
+ <CalendarClock className="w-3 h-3" />
)}
- {task.dueDate && (
- <div className="text-xs text-zinc-500 dark:text-zinc-400 font-medium">
- {format(new Date(task.dueDate), "MMM d")}
- </div>
+ {(getDueDateStatus(task.dueDate) === "far-future" ||
+ getDueDateStatus(task.dueDate) === "no-due-date") && (
+ <Calendar className="w-3 h-3" />
)}
+ <span>{format(new Date(task.dueDate), "MMM d")}</span>
</div>
- </div>
+ )}
+
+ {externalLinks.length > 0 && (
+ <PublicPRBadge externalLinks={externalLinks} />
+ )}
</div>
</button>
);
diff --git a/apps/web/src/components/public-project/task-detail-modal.tsx b/apps/web/src/components/public-project/task-detail-modal.tsx
index 6eb8156fd..74f5b6cdb 100644
--- a/apps/web/src/components/public-project/task-detail-modal.tsx
+++ b/apps/web/src/components/public-project/task-detail-modal.tsx
@@ -1,13 +1,29 @@
import * as Dialog from "@radix-ui/react-dialog";
import { format } from "date-fns";
-import { Calendar, Flag, User, X } from "lucide-react";
-import { Avatar, AvatarFallback } from "@/components/ui/avatar";
-import { priorityColorsTaskCard } from "@/constants/priority-colors";
-import { cn } from "@/lib/cn";
+import {
+ Calendar,
+ CalendarClock,
+ CalendarX,
+ ExternalLink,
+ GitBranch,
+ GitMerge,
+ GitPullRequest,
+ X,
+} from "lucide-react";
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
+import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";
+import { getPriorityIcon } from "@/lib/priority";
import type Task from "@/types/task";
+import { MarkdownRenderer } from "./markdown-renderer";
+import { PublicTaskLabels } from "./public-task-labels";
type PublicTaskDetailModalProps = {
- task: Task | null;
+ task:
+ | (Task & {
+ labels?: Array<{ id: string; name: string; color: string }>;
+ externalLinks?: Array<any>;
+ })
+ | null;
projectSlug: string;
open: boolean;
onOpenChange: (open: boolean) => void;
@@ -21,109 +37,245 @@ export function PublicTaskDetailModal({
}: PublicTaskDetailModalProps) {
if (!task) return null;
+ const labels = task.labels || [];
+ const externalLinks = task.externalLinks || [];
+
+ const pullRequests = externalLinks.filter(
+ (link) => link.resourceType === "pull_request",
+ );
+ const issues = externalLinks.filter((link) => link.resourceType === "issue");
+ const branches = externalLinks.filter(
+ (link) => link.resourceType === "branch",
+ );
+
+ const getPRStatus = (pr: (typeof pullRequests)[number]) => {
+ if (pr.metadata?.merged) {
+ return {
+ icon: <GitMerge className="w-3.5 h-3.5" />,
+ label: "Merged",
+ className: "text-purple-500",
+ };
+ }
+ if (pr.metadata?.draft) {
+ return {
+ icon: <GitPullRequest className="w-3.5 h-3.5" />,
+ label: "Draft",
+ className: "text-muted-foreground",
+ };
+ }
+ return {
+ icon: <GitPullRequest className="w-3.5 h-3.5" />,
+ label: "Open",
+ className: "text-green-500",
+ };
+ };
+
return (
<Dialog.Root open={open} onOpenChange={onOpenChange}>
<Dialog.Portal>
- <Dialog.Overlay className="fixed inset-0 bg-black/60 backdrop-blur-sm z-40" />
- <Dialog.Content className="fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-2xl max-h-[90vh] overflow-hidden">
- <div className="bg-white dark:bg-zinc-900 rounded-xl shadow-2xl border border-zinc-200 dark:border-zinc-700/50 flex flex-col h-full max-h-[90vh]">
- <div className="flex items-center justify-between p-6 border-b border-zinc-200 dark:border-zinc-800/50 flex-shrink-0">
- <div className="flex items-center gap-3">
- <div className="text-sm text-zinc-600 dark:text-zinc-400 font-mono font-medium">
+ <Dialog.Overlay className="fixed inset-0 bg-black/50 z-40" />
+ <Dialog.Content className="fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-3xl max-h-[85vh]">
+ <div className="bg-background border border-border rounded-lg flex flex-col max-h-[85vh] shadow-lg">
+ <div className="flex items-center justify-between p-4 border-b border-border shrink-0">
+ <div className="flex items-center gap-2 min-w-0 flex-1">
+ <span className="text-xs font-mono text-muted-foreground shrink-0">
{projectSlug.toUpperCase()}-{task.number}
- </div>
- <div className="w-1 h-1 bg-gradient-to-r from-indigo-400 to-purple-400 rounded-full" />
- <div className="text-sm text-zinc-700 dark:text-zinc-300 font-medium">
- Task Details
- </div>
+ </span>
+ <span className="text-xs text-muted-foreground px-1.5 py-0.5 bg-muted rounded capitalize shrink-0">
+ {task.status?.replace("-", " ")}
+ </span>
</div>
- <Dialog.Close className="text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 cursor-pointer p-2 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 rounded-lg transition-all duration-200">
- <X size={18} />
+ <Dialog.Close className="shrink-0 p-1.5 hover:bg-muted rounded transition-colors">
+ <X className="w-4 h-4 text-muted-foreground" />
</Dialog.Close>
</div>
- <div className="flex-1 overflow-y-auto">
- <div className="p-6 space-y-6">
- <div>
- <h1 className="text-xl font-semibold text-zinc-900 dark:text-zinc-100 leading-relaxed">
- {task.title}
- </h1>
- </div>
+ <div className="flex-1 overflow-y-auto p-6 space-y-6">
+ <div className="space-y-4">
+ <h2 className="text-xl font-semibold text-foreground pr-8">
+ {task.title}
+ </h2>
- <div className="flex flex-wrap items-center gap-4">
+ <div className="flex flex-wrap gap-2">
{task.priority && (
+ <div className="flex items-center gap-1.5 px-2.5 py-1 text-xs bg-muted text-muted-foreground rounded-md">
+ {getPriorityIcon(task.priority)}
+ <span className="capitalize">{task.priority}</span>
+ </div>
+ )}
+
+ {task.dueDate && (
<div
- className={cn(
- "flex items-center gap-2 text-sm px-3 py-1.5 rounded-full font-medium",
- priorityColorsTaskCard[
- task.priority as keyof typeof priorityColorsTaskCard
- ],
- )}
+ className={`flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}
>
- <Flag className="w-4 h-4" />
- <span className="capitalize">
- {task.priority} Priority
- </span>
+ {getDueDateStatus(task.dueDate) === "overdue" && (
+ <CalendarX className="w-3 h-3" />
+ )}
+ {getDueDateStatus(task.dueDate) === "due-soon" && (
+ <CalendarClock className="w-3 h-3" />
+ )}
+ {(getDueDateStatus(task.dueDate) === "far-future" ||
+ getDueDateStatus(task.dueDate) === "no-due-date") && (
+ <Calendar className="w-3 h-3" />
+ )}
+ <span>Due {format(new Date(task.dueDate), "MMM d")}</span>
</div>
)}
- {task.userId && (
- <div className="flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800/50 px-3 py-1.5 rounded-full">
- <User className="w-4 h-4" />
- <span>Assigned to</span>
- <Avatar className="h-5 w-5">
- <AvatarFallback className="text-xs font-medium">
- {task.assigneeName?.charAt(0).toUpperCase() ??
- task.userId?.charAt(0).toUpperCase()}
+ {task.assigneeName && (
+ <div className="flex items-center gap-2 px-2.5 py-1 text-xs bg-muted text-muted-foreground rounded-md">
+ <Avatar className="h-4 w-4">
+ <AvatarImage
+ src={task.assigneeImage ?? ""}
+ alt={task.assigneeName ?? ""}
+ />
+ <AvatarFallback className="text-[10px]">
+ {task.assigneeName.charAt(0).toUpperCase()}
</AvatarFallback>
</Avatar>
- <span className="font-medium">{task.assigneeName}</span>
+ <span>{task.assigneeName}</span>
</div>
)}
+ </div>
+ </div>
- {task.dueDate && (
- <div className="flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800/50 px-3 py-1.5 rounded-full">
- <Calendar className="w-4 h-4" />
- <span>
- Due {format(new Date(task.dueDate), "MMM d, yyyy")}
- </span>
- </div>
- )}
+ {labels.length > 0 && (
+ <div className="space-y-2">
+ <h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
+ Labels
+ </h3>
+ <PublicTaskLabels labels={labels} />
</div>
+ )}
- {task.description && (
- <div className="space-y-3">
- <h3 className="text-sm font-semibold text-zinc-900 dark:text-zinc-100 uppercase tracking-wide">
- Description
- </h3>
- {/* <MarkdownRenderer content={task.description} /> */}
+ {task.description && (
+ <div className="space-y-2">
+ <h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
+ Description
+ </h3>
+ <div className="text-sm text-foreground leading-relaxed bg-muted/30 p-4 rounded-md border border-border/50">
+ <MarkdownRenderer content={task.description} />
</div>
- )}
+ </div>
+ )}
+
+ {externalLinks.length > 0 && (
+ <div className="space-y-3">
+ <h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
+ External Links
+ </h3>
+
+ {pullRequests.length > 0 && (
+ <div className="space-y-2">
+ {pullRequests.map((pr) => {
+ const status = getPRStatus(pr);
+ const repoMatch = pr.url.match(
+ /github\.com\/([^/]+\/[^/]+)\/pull/,
+ );
+ const repoName = repoMatch ? repoMatch[1] : null;
+ return (
+ <a
+ key={pr.id}
+ href={pr.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="flex items-center justify-between p-3 bg-muted/50 hover:bg-muted rounded-md border border-border/50 transition-colors group"
+ >
+ <div className="flex items-center gap-2.5 flex-1 min-w-0">
+ <div className="flex flex-col gap-0.5 flex-1 min-w-0">
+ <span className="text-sm font-medium text-foreground truncate">
+ {pr.title || "Pull Request"}
+ </span>
+ <span className="text-xs text-muted-foreground">
+ {repoName}#{pr.externalId}
+ </span>
+ </div>
+ </div>
+ <div className="flex items-center gap-2 shrink-0">
+ <span
+ className={`text-xs font-medium flex items-center gap-1 ${status.className}`}
+ >
+ {status.icon}
+ {status.label}
+ </span>
+ <ExternalLink className="w-3.5 h-3.5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity" />
+ </div>
+ </a>
+ );
+ })}
+ </div>
+ )}
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4 pt-4 border-t border-zinc-200 dark:border-zinc-800">
- <div className="space-y-1">
- <div className="text-xs font-semibold text-zinc-600 dark:text-zinc-400 uppercase tracking-wide">
- Created
+ {issues.length > 0 && (
+ <div className="space-y-2">
+ {issues.map((issue) => (
+ <a
+ key={issue.id}
+ href={issue.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="flex items-center justify-between p-3 bg-muted/50 hover:bg-muted rounded-md border border-border/50 transition-colors group"
+ >
+ <div className="flex items-center gap-2.5 flex-1 min-w-0">
+ <GitPullRequest className="w-3.5 h-3.5 text-muted-foreground" />
+ <div className="flex flex-col gap-0.5 flex-1 min-w-0">
+ <span className="text-sm font-medium text-foreground truncate">
+ {issue.title || "Issue"}
+ </span>
+ <span className="text-xs text-muted-foreground">
+ #{issue.externalId}
+ </span>
+ </div>
+ </div>
+ <ExternalLink className="w-3.5 h-3.5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity" />
+ </a>
+ ))}
</div>
- <div className="text-sm text-zinc-900 dark:text-zinc-100">
- {format(new Date(task.createdAt), "MMM d, yyyy")}
+ )}
+
+ {branches.length > 0 && (
+ <div className="space-y-2">
+ {branches.map((branch) => (
+ <a
+ key={branch.id}
+ href={branch.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="flex items-center justify-between p-3 bg-muted/50 hover:bg-muted rounded-md border border-border/50 transition-colors group"
+ >
+ <div className="flex items-center gap-2.5 flex-1 min-w-0">
+ <GitBranch className="w-3.5 h-3.5 text-muted-foreground" />
+ <span className="text-sm font-medium text-foreground truncate">
+ {branch.title || branch.externalId}
+ </span>
+ </div>
+ <ExternalLink className="w-3.5 h-3.5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity" />
+ </a>
+ ))}
</div>
+ )}
+ </div>
+ )}
+
+ <div className="grid grid-cols-2 gap-4 pt-4 border-t border-border/50">
+ <div>
+ <div className="text-xs text-muted-foreground mb-1">
+ Created
</div>
- <div className="space-y-1">
- <div className="text-xs font-semibold text-zinc-600 dark:text-zinc-400 uppercase tracking-wide">
- Last Updated
+ <div className="text-sm text-foreground">
+ {format(new Date(task.createdAt), "MMM d, yyyy")}
+ </div>
+ </div>
+ {task.dueDate && (
+ <div>
+ <div className="text-xs text-muted-foreground mb-1">
+ Due Date
</div>
- <div className="text-sm text-zinc-900 dark:text-zinc-100">
- {format(new Date(task.createdAt), "MMM d, yyyy")}
+ <div className="text-sm text-foreground">
+ {format(new Date(task.dueDate), "MMM d, yyyy")}
</div>
</div>
- </div>
- </div>
- </div>
-
- <div className="border-t border-zinc-200 dark:border-zinc-800/50 p-4 flex-shrink-0">
- <div className="text-center text-xs text-zinc-500 dark:text-zinc-400">
- This is a read-only view of the task
+ )}
</div>
</div>
</div>
diff --git a/apps/web/src/components/public-project/task-row.tsx b/apps/web/src/components/public-project/task-row.tsx
index e1163831c..80287f7ca 100644
--- a/apps/web/src/components/public-project/task-row.tsx
+++ b/apps/web/src/components/public-project/task-row.tsx
@@ -1,12 +1,17 @@
import { format } from "date-fns";
import { Calendar, CalendarClock, CalendarX } from "lucide-react";
-import { Avatar, AvatarFallback } from "@/components/ui/avatar";
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";
import { getPriorityIcon } from "@/lib/priority";
import type Task from "@/types/task";
+import { PublicPRBadge } from "./public-pr-badge";
+import { PublicTaskLabels } from "./public-task-labels";
type PublicTaskRowProps = {
- task: Task;
+ task: Task & {
+ labels?: Array<{ id: string; name: string; color: string }>;
+ externalLinks?: Array<any>;
+ };
projectSlug: string;
onTaskClick: (task: Task) => void;
};
@@ -16,29 +21,44 @@ export function PublicTaskRow({
projectSlug,
onTaskClick,
}: PublicTaskRowProps) {
+ const labels = task.labels || [];
+ const externalLinks = task.externalLinks || [];
+
return (
<button
type="button"
- className="group w-full text-left px-4 py-3 rounded-lg flex items-center gap-4 bg-white dark:bg-zinc-800/80 border border-zinc-200 dark:border-zinc-700/50 shadow-sm hover:shadow-md transition-all hover:border-zinc-300 dark:hover:border-zinc-600 hover:scale-[1.01] focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
+ className="group w-full text-left px-4 py-3 rounded-lg flex items-center gap-4 bg-card border border-border shadow-sm hover:shadow-md transition-all duration-200 ease-out hover:border-border/70 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
onClick={() => onTaskClick(task)}
aria-label={`View details for task ${task.title}`}
>
<div className="flex-1 min-w-0 flex items-center gap-3">
- <div className="text-xs font-mono text-zinc-500 dark:text-zinc-400 shrink-0 font-medium">
+ <div className="text-xs font-mono text-muted-foreground shrink-0 font-medium">
{projectSlug}-{task.number}
</div>
- <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate">
- {task.title}
- </h3>
+ <div className="flex flex-col gap-1 flex-1 min-w-0">
+ <h3 className="text-sm font-medium text-foreground truncate">
+ {task.title}
+ </h3>
+ {labels.length > 0 && <PublicTaskLabels labels={labels} />}
+ </div>
</div>
- <div className="flex items-center gap-3">
- {task.userId && (
- <Avatar className="h-6 w-6 ring-2 ring-zinc-100 dark:ring-zinc-700">
- <AvatarFallback className="text-xs font-medium">
- {task.userId.charAt(0).toUpperCase()}
- </AvatarFallback>
- </Avatar>
+ <div className="flex items-center gap-2">
+ {task.assigneeName && (
+ <div className="flex items-center gap-1.5">
+ <Avatar className="h-5 w-5">
+ <AvatarImage
+ src={task.assigneeImage ?? ""}
+ alt={task.assigneeName ?? ""}
+ />
+ <AvatarFallback className="text-[10px] font-medium border border-border/30">
+ {task.assigneeName.charAt(0).toUpperCase()}
+ </AvatarFallback>
+ </Avatar>
+ <span className="text-xs text-muted-foreground font-medium">
+ {task.assigneeName}
+ </span>
+ </div>
)}
{task.dueDate && (
@@ -64,6 +84,10 @@ export function PublicTaskRow({
{getPriorityIcon(task.priority)}
</div>
)}
+
+ {externalLinks.length > 0 && (
+ <PublicPRBadge externalLinks={externalLinks} />
+ )}
</div>
</button>
);
diff --git a/apps/web/src/components/public-project/theme-toggle.tsx b/apps/web/src/components/public-project/theme-toggle.tsx
index e983a9a7f..1780d50c6 100644
--- a/apps/web/src/components/public-project/theme-toggle.tsx
+++ b/apps/web/src/components/public-project/theme-toggle.tsx
@@ -14,13 +14,18 @@ export function ThemeToggle() {
};
return (
- <Button variant="outline" size="sm" onClick={toggleTheme} className="gap-2">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={toggleTheme}
+ className="h-8 w-8 p-0"
+ aria-label={`Switch to ${theme === "dark" ? "light" : "dark"} mode`}
+ >
{theme === "dark" ? (
- <Sun className="w-4 h-4" />
+ <Sun className="w-3.5 h-3.5" />
) : (
- <Moon className="w-4 h-4" />
+ <Moon className="w-3.5 h-3.5" />
)}
- {theme === "dark" ? "Light" : "Dark"}
</Button>
);
}
diff --git a/apps/web/src/components/task/task-details-content.tsx b/apps/web/src/components/task/task-details-content.tsx
new file mode 100644
index 000000000..8499f6383
--- /dev/null
+++ b/apps/web/src/components/task/task-details-content.tsx
@@ -0,0 +1,71 @@
+import Activity from "@/components/activity";
+import CommentInput from "@/components/activity/comment-input";
+import { ExternalLinksAccordion } from "@/components/external-links/external-links-accordion";
+import useAuth from "@/components/providers/auth-provider/hooks/use-auth";
+import useGetActivitiesByTaskId from "@/hooks/queries/activity/use-get-activities-by-task-id";
+import useExternalLinks from "@/hooks/queries/external-link/use-external-links";
+import useGetProject from "@/hooks/queries/project/use-get-project";
+import useGetTask from "@/hooks/queries/task/use-get-task";
+import type { ExternalLink } from "@/types/external-link";
+import TaskDescription from "./task-description";
+import TaskTitle from "./task-title";
+
+type TaskDetailsContentProps = {
+ taskId: string | undefined;
+ projectId: string;
+ workspaceId: string;
+ className?: string;
+};
+
+export default function TaskDetailsContent({
+ taskId,
+ projectId,
+ workspaceId,
+ className,
+}: TaskDetailsContentProps) {
+ const { data: task } = useGetTask(taskId ?? "");
+ const { data: project } = useGetProject({ id: projectId, workspaceId });
+ const { data: activities = [] } = useGetActivitiesByTaskId(taskId ?? "");
+ const { data: externalLinks = [], isLoading: isLoadingExternalLinks } =
+ useExternalLinks(taskId ?? "");
+ const { user } = useAuth();
+
+ if (!taskId) return null;
+
+ return (
+ <div className={className}>
+ <p className="text-xs font-semibold text-muted-foreground">
+ {project?.slug}-{task?.number}
+ </p>
+ <TaskTitle taskId={taskId} />
+ <TaskDescription taskId={taskId} />
+ {!isLoadingExternalLinks && externalLinks.length > 0 && (
+ <div className="mt-4">
+ <ExternalLinksAccordion
+ externalLinks={externalLinks as ExternalLink[]}
+ isLoading={isLoadingExternalLinks}
+ />
+ </div>
+ )}
+ <span className="text-sm font-medium text-muted-foreground h-[1px] bg-border w-full block mt-4" />
+ <div className="flex flex-col gap-4 pt-8">
+ <h1 className="text-md font-semibold">Activity</h1>
+ {user?.id && taskId && <CommentInput taskId={taskId} />}
+ <div className="flex flex-col">
+ {activities.length === 0 && (
+ <p className="text-sm font-medium text-muted-foreground">
+ No activity found
+ </p>
+ )}
+ {activities.map((activity, index) => (
+ <Activity
+ key={activity.id}
+ activity={activity}
+ isLast={index === activities.length - 1}
+ />
+ ))}
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/task/task-details-sheet.tsx b/apps/web/src/components/task/task-details-sheet.tsx
new file mode 100644
index 000000000..28bd0f3db
--- /dev/null
+++ b/apps/web/src/components/task/task-details-sheet.tsx
@@ -0,0 +1,157 @@
+import { useNavigate } from "@tanstack/react-router";
+import { Maximize2, X } from "lucide-react";
+import { useCallback, useEffect, useRef, useState } from "react";
+import { Button } from "@/components/ui/button";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import useGetProject from "@/hooks/queries/project/use-get-project";
+import useGetTask from "@/hooks/queries/task/use-get-task";
+import { cn } from "@/lib/cn";
+import TaskDetailsContent from "./task-details-content";
+import TaskPropertiesSidebar from "./task-properties-sidebar";
+
+type TaskDetailsSheetProps = {
+ taskId: string | undefined;
+ projectId: string;
+ workspaceId: string;
+ onClose: () => void;
+};
+
+export default function TaskDetailsSheet({
+ taskId,
+ projectId,
+ workspaceId,
+ onClose,
+}: TaskDetailsSheetProps) {
+ const navigate = useNavigate();
+ const panelRef = useRef<HTMLDivElement>(null);
+ const [isVisible, setIsVisible] = useState(false);
+ const [currentTaskId, setCurrentTaskId] = useState<string | undefined>(
+ taskId,
+ );
+
+ const { data: task } = useGetTask(currentTaskId ?? "");
+ const { data: project } = useGetProject({ id: projectId, workspaceId });
+
+ useEffect(() => {
+ if (taskId) {
+ setCurrentTaskId(taskId);
+ setIsVisible(true);
+ } else {
+ setIsVisible(false);
+ const timer = setTimeout(() => {
+ setCurrentTaskId(undefined);
+ }, 300);
+ return () => clearTimeout(timer);
+ }
+ }, [taskId]);
+
+ const handleOpenFullPage = useCallback(() => {
+ if (!currentTaskId) return;
+ navigate({
+ to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",
+ params: {
+ workspaceId,
+ projectId,
+ taskId: currentTaskId,
+ },
+ });
+ }, [navigate, workspaceId, projectId, currentTaskId]);
+
+ useEffect(() => {
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (e.key === "Escape" && isVisible) {
+ onClose();
+ }
+ };
+
+ document.addEventListener("keydown", handleKeyDown);
+ return () => document.removeEventListener("keydown", handleKeyDown);
+ }, [isVisible, onClose]);
+
+ useEffect(() => {
+ const handleClickOutside = (e: MouseEvent) => {
+ if (
+ isVisible &&
+ panelRef.current &&
+ !panelRef.current.contains(e.target as Node)
+ ) {
+ onClose();
+ }
+ };
+
+ document.addEventListener("mousedown", handleClickOutside);
+ return () => document.removeEventListener("mousedown", handleClickOutside);
+ }, [isVisible, onClose]);
+
+ if (!currentTaskId && !isVisible) {
+ return null;
+ }
+
+ return (
+ <div
+ ref={panelRef}
+ className={cn(
+ "absolute top-0 right-0 bottom-0 w-full max-w-full sm:max-w-md md:max-w-lg lg:max-w-2xl bg-background border-l border-border shadow-xl z-40 flex flex-col transform transition-transform duration-300 ease-in-out",
+ isVisible ? "translate-x-0" : "translate-x-full",
+ )}
+ >
+ <div className="flex items-center justify-between px-3 sm:px-4 py-3 border-b border-border bg-background shrink-0">
+ <div className="flex items-center gap-2">
+ <span className="text-sm font-medium text-muted-foreground">
+ {project?.slug}-{task?.number}
+ </span>
+ </div>
+ <div className="flex items-center gap-1">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={handleOpenFullPage}
+ className="text-muted-foreground hover:text-foreground"
+ >
+ <Maximize2 className="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Open in full page</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={onClose}
+ className="text-muted-foreground hover:text-foreground"
+ >
+ <X className="size-4" />
+ </Button>
+ </div>
+ </div>
+
+ <div className="flex flex-col lg:flex-row flex-1 min-h-0 overflow-hidden">
+ <div className="flex-1 overflow-y-auto order-2 lg:order-1">
+ <div className="px-3 sm:px-4 py-4">
+ <TaskDetailsContent
+ taskId={currentTaskId}
+ projectId={projectId}
+ workspaceId={workspaceId}
+ className="flex flex-col gap-2"
+ />
+ </div>
+ </div>
+
+ <TaskPropertiesSidebar
+ taskId={currentTaskId}
+ projectId={projectId}
+ workspaceId={workspaceId}
+ className="w-full lg:w-52 bg-sidebar border-b lg:border-b-0 lg:border-l border-border flex flex-col gap-2 overflow-y-auto shrink-0 order-1 lg:order-2"
+ />
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/task/task-properties-sidebar.tsx b/apps/web/src/components/task/task-properties-sidebar.tsx
new file mode 100644
index 000000000..9868a51c2
--- /dev/null
+++ b/apps/web/src/components/task/task-properties-sidebar.tsx
@@ -0,0 +1,318 @@
+import { format } from "date-fns";
+import {
+ Calendar,
+ CalendarClock,
+ CalendarX,
+ Copy,
+ GitBranch,
+ Plus,
+} from "lucide-react";
+import { toast } from "sonner";
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
+import { Badge } from "@/components/ui/badge";
+import { Button } from "@/components/ui/button";
+import { KbdSequence } from "@/components/ui/kbd";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import labelColors from "@/constants/label-colors";
+import useGetGithubIntegration from "@/hooks/queries/github-integration/use-get-github-integration";
+import useGetLabelsByTask from "@/hooks/queries/label/use-get-labels-by-task";
+import useGetProject from "@/hooks/queries/project/use-get-project";
+import useGetTask from "@/hooks/queries/task/use-get-task";
+import { useGetActiveWorkspaceUsers } from "@/hooks/queries/workspace-users/use-get-active-workspace-users";
+import { getColumnIcon } from "@/lib/column";
+import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";
+import { getPriorityIcon } from "@/lib/priority";
+import TaskAssigneePopover from "./task-assignee-popover";
+import TaskDueDatePopover from "./task-due-date-popover";
+import TaskLabelsPopover from "./task-labels-popover";
+import TaskPriorityPopover from "./task-priority-popover";
+import TaskStatusPopover from "./task-status-popover";
+
+function slugify(text: string | undefined): string {
+ if (!text) return "";
+ return text
+ .toLowerCase()
+ .replace(/[^a-z0-9]+/g, "-")
+ .replace(/^-|-$/g, "")
+ .slice(0, 50);
+}
+
+function generateBranchName(
+ pattern: string,
+ projectSlug: string | undefined,
+ taskNumber: number | null | undefined,
+ taskTitle: string | undefined,
+): string {
+ if (!projectSlug || !taskNumber) return "";
+ return pattern
+ .replace("{slug}", projectSlug.toLowerCase())
+ .replace("{number}", taskNumber.toString())
+ .replace("{title}", slugify(taskTitle));
+}
+
+function toNormalCase(str: string | undefined) {
+ if (!str) return str;
+ return str
+ .replace(/[-_]/g, " ")
+ .split(" ")
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
+ .join(" ");
+}
+
+type TaskPropertiesSidebarProps = {
+ taskId: string | undefined;
+ projectId: string;
+ workspaceId: string;
+ className?: string;
+};
+
+export default function TaskPropertiesSidebar({
+ taskId,
+ projectId,
+ workspaceId,
+ className,
+}: TaskPropertiesSidebarProps) {
+ const { data: task } = useGetTask(taskId ?? "");
+ const { data: project } = useGetProject({ id: projectId, workspaceId });
+ const { data: workspaceUsers } = useGetActiveWorkspaceUsers(workspaceId);
+ const { data: taskLabels = [] } = useGetLabelsByTask(taskId);
+ const { data: githubIntegration } = useGetGithubIntegration(projectId);
+
+ const projectSlug = project?.slug;
+ const taskNumber = task?.number;
+ const branchPattern = githubIntegration?.branchPattern || "{slug}-{number}";
+
+ const assignee = workspaceUsers?.members?.find(
+ (member) => member.userId === task?.userId,
+ );
+
+ const handleCopyTaskLink = () => {
+ navigator.clipboard.writeText(
+ `${window.location.origin}/workspace/${workspaceId}/project/${projectId}/task/${taskId}`,
+ );
+ toast.message("Task link copied to clipboard");
+ };
+
+ const handleCopyTaskBranch = () => {
+ const branchName = generateBranchName(
+ branchPattern,
+ projectSlug,
+ taskNumber,
+ task?.title,
+ );
+ navigator.clipboard.writeText(branchName);
+ toast.message("Task branch copied to clipboard");
+ };
+
+ return (
+ <div className={className}>
+ <div className="flex gap-2 p-3 lg:p-4 lg:px-4">
+ <p className="text-sm font-medium text-muted-foreground flex-1">
+ Properties
+ </p>
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="xs"
+ className="text-muted-foreground"
+ onClick={() => handleCopyTaskLink()}
+ >
+ <Copy className="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <KbdSequence
+ keys={["Ctrl", "Shift", "C"]}
+ description="Copy task link"
+ separator=""
+ />
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="xs"
+ className="text-muted-foreground"
+ onClick={() => handleCopyTaskBranch()}
+ >
+ <GitBranch className="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <KbdSequence
+ keys={["Ctrl", "Shift", "G"]}
+ description="Copy task branch"
+ separator=""
+ />
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
+
+ <div className="flex flex-row flex-wrap lg:flex-col gap-1 lg:gap-2 items-start px-3 lg:px-4 pb-3 lg:pb-0">
+ {task && (
+ <TaskStatusPopover task={task}>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="justify-start h-8 px-2"
+ >
+ {getColumnIcon(task.status ?? "")}
+ <span className="text-xs font-semibold truncate">
+ {toNormalCase(task.status)}
+ </span>
+ </Button>
+ </TaskStatusPopover>
+ )}
+ {task && (
+ <TaskPriorityPopover task={task}>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="justify-start h-8 px-2"
+ >
+ {getPriorityIcon(task.priority ?? "")}
+ <span className="text-xs font-semibold truncate">
+ {toNormalCase(task.priority ?? "")}
+ </span>
+ </Button>
+ </TaskPriorityPopover>
+ )}
+ {task && (
+ <TaskAssigneePopover task={task} workspaceId={workspaceId}>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="justify-start h-8 px-2"
+ >
+ {task.userId ? (
+ <Avatar className="h-[18px] w-[18px]">
+ <AvatarImage
+ src={assignee?.user?.image ?? ""}
+ alt={assignee?.user?.name || ""}
+ />
+ <AvatarFallback className="text-[10px] font-medium border border-border/30 flex-shrink-0 h-[18px] w-[18px]">
+ {assignee?.user?.name?.charAt(0).toUpperCase()}
+ </AvatarFallback>
+ </Avatar>
+ ) : (
+ <div
+ className="w-[18px] h-[18px] rounded-full bg-muted border border-border flex items-center justify-center flex-shrink-0"
+ title="Unassigned"
+ >
+ <span className="text-[9px] font-medium">?</span>
+ </div>
+ )}
+ <span className="text-xs font-semibold truncate max-w-[100px]">
+ {assignee?.user?.name || task.assigneeName || "Unassigned"}
+ </span>
+ </Button>
+ </TaskAssigneePopover>
+ )}
+ {task && (
+ <TaskDueDatePopover task={task}>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="justify-start h-8 px-2"
+ >
+ {task.dueDate ? (
+ <>
+ {getDueDateStatus(task.dueDate) === "overdue" && (
+ <CalendarX
+ className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}
+ />
+ )}
+ {getDueDateStatus(task.dueDate) === "due-soon" && (
+ <CalendarClock
+ className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}
+ />
+ )}
+ {(getDueDateStatus(task.dueDate) === "far-future" ||
+ getDueDateStatus(task.dueDate) === "no-due-date") && (
+ <Calendar
+ className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}
+ />
+ )}
+ <span className="text-xs font-semibold">
+ {format(new Date(task.dueDate), "MMM d")}
+ </span>
+ </>
+ ) : (
+ <>
+ <Calendar className="w-3.5 h-3.5 text-muted-foreground" />
+ <span className="text-xs font-semibold text-muted-foreground">
+ No date
+ </span>
+ </>
+ )}
+ </Button>
+ </TaskDueDatePopover>
+ )}
+ </div>
+
+ <div className="hidden lg:block w-full h-[1px] bg-border my-2" />
+
+ <div className="hidden lg:flex px-3 lg:px-4 pb-3 lg:pb-4 flex-col gap-3">
+ <div className="flex flex-col gap-1">
+ <span className="text-xs font-medium text-muted-foreground px-2">
+ Labels
+ </span>
+ <div className="flex flex-wrap items-center gap-1.5 px-2">
+ {task &&
+ taskLabels.length > 0 &&
+ taskLabels.map(
+ (label: { id: string; name: string; color: string }) => (
+ <TaskLabelsPopover
+ key={`edit-${label.id}`}
+ task={task}
+ workspaceId={workspaceId}
+ >
+ <Badge
+ variant="outline"
+ className="flex items-center gap-1 px-1.5 py-0.5 cursor-pointer hover:bg-accent/50 transition-colors text-[10px]"
+ >
+ <span
+ className="w-1.5 h-1.5 rounded-full flex-shrink-0"
+ style={{
+ backgroundColor:
+ labelColors.find((c) => c.value === label.color)
+ ?.color || "#94a3b8",
+ }}
+ />
+ <span className="truncate max-w-[60px]">
+ {label.name}
+ </span>
+ </Badge>
+ </TaskLabelsPopover>
+ ),
+ )}
+
+ {task && (
+ <TaskLabelsPopover task={task} workspaceId={workspaceId}>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="h-5 w-5 p-0 rounded-full"
+ >
+ <Plus className="h-3 w-3" />
+ </Button>
+ </TaskLabelsPopover>
+ )}
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/fetchers/invitation/get-invitation-details.ts b/apps/web/src/fetchers/invitation/get-invitation-details.ts
new file mode 100644
index 000000000..b3f5dbbe0
--- /dev/null
+++ b/apps/web/src/fetchers/invitation/get-invitation-details.ts
@@ -0,0 +1,35 @@
+import { client } from "@kaneo/libs";
+
+export type InvitationDetails = {
+ id: string;
+ email: string;
+ workspaceName: string;
+ inviterName: string;
+ expiresAt: string;
+ status: string;
+ expired: boolean;
+};
+
+export type GetInvitationDetailsResponse = {
+ valid: boolean;
+ invitation?: InvitationDetails;
+ error?: string;
+};
+
+export async function getInvitationDetails(
+ invitationId: string,
+): Promise<GetInvitationDetailsResponse> {
+ const response = await client.invitation[":id"].$get({
+ param: {
+ id: invitationId,
+ },
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ const result = await response.json();
+ return result;
+}
diff --git a/apps/web/src/hooks/queries/invitation/use-get-invitation-details.ts b/apps/web/src/hooks/queries/invitation/use-get-invitation-details.ts
new file mode 100644
index 000000000..b278b11fd
--- /dev/null
+++ b/apps/web/src/hooks/queries/invitation/use-get-invitation-details.ts
@@ -0,0 +1,10 @@
+import { useQuery } from "@tanstack/react-query";
+import { getInvitationDetails } from "@/fetchers/invitation/get-invitation-details";
+
+export function useGetInvitationDetails(invitationId: string | undefined) {
+ return useQuery({
+ queryKey: ["invitation-details", invitationId],
+ queryFn: () => getInvitationDetails(invitationId!),
+ enabled: !!invitationId,
+ });
+}
diff --git a/apps/web/src/lib/auth-client.ts b/apps/web/src/lib/auth-client.ts
index ba57d6529..e0fce7f80 100644
--- a/apps/web/src/lib/auth-client.ts
+++ b/apps/web/src/lib/auth-client.ts
@@ -1,6 +1,7 @@
import {
anonymousClient,
apiKeyClient,
+ emailOTPClient,
genericOAuthClient,
lastLoginMethodClient,
magicLinkClient,
@@ -26,6 +27,7 @@ export const authClient = createAuthClient({
anonymousClient(),
lastLoginMethodClient(),
magicLinkClient(),
+ emailOTPClient(),
organizationClient({
ac,
roles: {
diff --git a/apps/web/src/routeTree.gen.ts b/apps/web/src/routeTree.gen.ts
index 2f93602fb..21c94bfa6 100644
--- a/apps/web/src/routeTree.gen.ts
+++ b/apps/web/src/routeTree.gen.ts
@@ -14,11 +14,12 @@ import { Route as AuthRouteImport } from './routes/auth'
import { Route as LayoutRouteImport } from './routes/_layout'
import { Route as IndexRouteImport } from './routes/index'
import { Route as PublicProjectProjectIdRouteImport } from './routes/public-project.$projectId'
+import { Route as AuthVerifyOtpRouteImport } from './routes/auth/verify-otp'
import { Route as AuthSignUpRouteImport } from './routes/auth/sign-up'
import { Route as AuthSignInRouteImport } from './routes/auth/sign-in'
import { Route as AuthCheckEmailRouteImport } from './routes/auth/check-email'
import { Route as LayoutAuthenticatedRouteImport } from './routes/_layout/_authenticated'
-import { Route as AuthAcceptInvitationInviteIdRouteImport } from './routes/auth/accept-invitation/$inviteId'
+import { Route as InvitationAcceptInviteIdRouteImport } from './routes/invitation/accept.$inviteId'
import { Route as LayoutAuthenticatedProfileSetupRouteImport } from './routes/_layout/_authenticated/profile-setup'
import { Route as LayoutAuthenticatedOnboardingRouteImport } from './routes/_layout/_authenticated/onboarding'
import { Route as LayoutAuthenticatedDashboardRouteImport } from './routes/_layout/_authenticated/dashboard'
@@ -68,6 +69,11 @@ const PublicProjectProjectIdRoute = PublicProjectProjectIdRouteImport.update({
path: '/public-project/$projectId',
getParentRoute: () => rootRouteImport,
} as any)
+const AuthVerifyOtpRoute = AuthVerifyOtpRouteImport.update({
+ id: '/verify-otp',
+ path: '/verify-otp',
+ getParentRoute: () => AuthRoute,
+} as any)
const AuthSignUpRoute = AuthSignUpRouteImport.update({
id: '/sign-up',
path: '/sign-up',
@@ -87,11 +93,11 @@ const LayoutAuthenticatedRoute = LayoutAuthenticatedRouteImport.update({
id: '/_authenticated',
getParentRoute: () => LayoutRoute,
} as any)
-const AuthAcceptInvitationInviteIdRoute =
- AuthAcceptInvitationInviteIdRouteImport.update({
- id: '/accept-invitation/$inviteId',
- path: '/accept-invitation/$inviteId',
- getParentRoute: () => AuthRoute,
+const InvitationAcceptInviteIdRoute =
+ InvitationAcceptInviteIdRouteImport.update({
+ id: '/invitation/accept/$inviteId',
+ path: '/invitation/accept/$inviteId',
+ getParentRoute: () => rootRouteImport,
} as any)
const LayoutAuthenticatedProfileSetupRoute =
LayoutAuthenticatedProfileSetupRouteImport.update({
@@ -263,11 +269,12 @@ export interface FileRoutesByFullPath {
'/auth/check-email': typeof AuthCheckEmailRoute
'/auth/sign-in': typeof AuthSignInRoute
'/auth/sign-up': typeof AuthSignUpRoute
+ '/auth/verify-otp': typeof AuthVerifyOtpRoute
'/public-project/$projectId': typeof PublicProjectProjectIdRoute
'/dashboard': typeof LayoutAuthenticatedDashboardRouteWithChildren
'/onboarding': typeof LayoutAuthenticatedOnboardingRoute
'/profile-setup': typeof LayoutAuthenticatedProfileSetupRoute
- '/auth/accept-invitation/$inviteId': typeof AuthAcceptInvitationInviteIdRoute
+ '/invitation/accept/$inviteId': typeof InvitationAcceptInviteIdRoute
'/dashboard/settings': typeof LayoutAuthenticatedDashboardSettingsRouteWithChildren
'/dashboard/': typeof LayoutAuthenticatedDashboardIndexRoute
'/dashboard/settings/account': typeof LayoutAuthenticatedDashboardSettingsAccountRouteWithChildren
@@ -297,10 +304,11 @@ export interface FileRoutesByTo {
'/auth/check-email': typeof AuthCheckEmailRoute
'/auth/sign-in': typeof AuthSignInRoute
'/auth/sign-up': typeof AuthSignUpRoute
+ '/auth/verify-otp': typeof AuthVerifyOtpRoute
'/public-project/$projectId': typeof PublicProjectProjectIdRoute
'/onboarding': typeof LayoutAuthenticatedOnboardingRoute
'/profile-setup': typeof LayoutAuthenticatedProfileSetupRoute
- '/auth/accept-invitation/$inviteId': typeof AuthAcceptInvitationInviteIdRoute
+ '/invitation/accept/$inviteId': typeof InvitationAcceptInviteIdRoute
'/dashboard/settings': typeof LayoutAuthenticatedDashboardSettingsRouteWithChildren
'/dashboard': typeof LayoutAuthenticatedDashboardIndexRoute
'/dashboard/settings/account': typeof LayoutAuthenticatedDashboardSettingsAccountRouteWithChildren
@@ -332,11 +340,12 @@ export interface FileRoutesById {
'/auth/check-email': typeof AuthCheckEmailRoute
'/auth/sign-in': typeof AuthSignInRoute
'/auth/sign-up': typeof AuthSignUpRoute
+ '/auth/verify-otp': typeof AuthVerifyOtpRoute
'/public-project/$projectId': typeof PublicProjectProjectIdRoute
'/_layout/_authenticated/dashboard': typeof LayoutAuthenticatedDashboardRouteWithChildren
'/_layout/_authenticated/onboarding': typeof LayoutAuthenticatedOnboardingRoute
'/_layout/_authenticated/profile-setup': typeof LayoutAuthenticatedProfileSetupRoute
- '/auth/accept-invitation/$inviteId': typeof AuthAcceptInvitationInviteIdRoute
+ '/invitation/accept/$inviteId': typeof InvitationAcceptInviteIdRoute
'/_layout/_authenticated/dashboard/settings': typeof LayoutAuthenticatedDashboardSettingsRouteWithChildren
'/_layout/_authenticated/dashboard/': typeof LayoutAuthenticatedDashboardIndexRoute
'/_layout/_authenticated/dashboard/settings/account': typeof LayoutAuthenticatedDashboardSettingsAccountRouteWithChildren
@@ -368,11 +377,12 @@ export interface FileRouteTypes {
| '/auth/check-email'
| '/auth/sign-in'
| '/auth/sign-up'
+ | '/auth/verify-otp'
| '/public-project/$projectId'
| '/dashboard'
| '/onboarding'
| '/profile-setup'
- | '/auth/accept-invitation/$inviteId'
+ | '/invitation/accept/$inviteId'
| '/dashboard/settings'
| '/dashboard/'
| '/dashboard/settings/account'
@@ -402,10 +412,11 @@ export interface FileRouteTypes {
| '/auth/check-email'
| '/auth/sign-in'
| '/auth/sign-up'
+ | '/auth/verify-otp'
| '/public-project/$projectId'
| '/onboarding'
| '/profile-setup'
- | '/auth/accept-invitation/$inviteId'
+ | '/invitation/accept/$inviteId'
| '/dashboard/settings'
| '/dashboard'
| '/dashboard/settings/account'
@@ -436,11 +447,12 @@ export interface FileRouteTypes {
| '/auth/check-email'
| '/auth/sign-in'
| '/auth/sign-up'
+ | '/auth/verify-otp'
| '/public-project/$projectId'
| '/_layout/_authenticated/dashboard'
| '/_layout/_authenticated/onboarding'
| '/_layout/_authenticated/profile-setup'
- | '/auth/accept-invitation/$inviteId'
+ | '/invitation/accept/$inviteId'
| '/_layout/_authenticated/dashboard/settings'
| '/_layout/_authenticated/dashboard/'
| '/_layout/_authenticated/dashboard/settings/account'
@@ -470,6 +482,7 @@ export interface RootRouteChildren {
AuthRoute: typeof AuthRouteWithChildren
TestErrorRoute: typeof TestErrorRoute
PublicProjectProjectIdRoute: typeof PublicProjectProjectIdRoute
+ InvitationAcceptInviteIdRoute: typeof InvitationAcceptInviteIdRoute
}
declare module '@tanstack/react-router' {
@@ -509,6 +522,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof PublicProjectProjectIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/auth/verify-otp': {
+ id: '/auth/verify-otp'
+ path: '/verify-otp'
+ fullPath: '/auth/verify-otp'
+ preLoaderRoute: typeof AuthVerifyOtpRouteImport
+ parentRoute: typeof AuthRoute
+ }
'/auth/sign-up': {
id: '/auth/sign-up'
path: '/sign-up'
@@ -537,12 +557,12 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof LayoutAuthenticatedRouteImport
parentRoute: typeof LayoutRoute
}
- '/auth/accept-invitation/$inviteId': {
- id: '/auth/accept-invitation/$inviteId'
- path: '/accept-invitation/$inviteId'
- fullPath: '/auth/accept-invitation/$inviteId'
- preLoaderRoute: typeof AuthAcceptInvitationInviteIdRouteImport
- parentRoute: typeof AuthRoute
+ '/invitation/accept/$inviteId': {
+ id: '/invitation/accept/$inviteId'
+ path: '/invitation/accept/$inviteId'
+ fullPath: '/invitation/accept/$inviteId'
+ preLoaderRoute: typeof InvitationAcceptInviteIdRouteImport
+ parentRoute: typeof rootRouteImport
}
'/_layout/_authenticated/profile-setup': {
id: '/_layout/_authenticated/profile-setup'
@@ -881,14 +901,14 @@ interface AuthRouteChildren {
AuthCheckEmailRoute: typeof AuthCheckEmailRoute
AuthSignInRoute: typeof AuthSignInRoute
AuthSignUpRoute: typeof AuthSignUpRoute
- AuthAcceptInvitationInviteIdRoute: typeof AuthAcceptInvitationInviteIdRoute
+ AuthVerifyOtpRoute: typeof AuthVerifyOtpRoute
}
const AuthRouteChildren: AuthRouteChildren = {
AuthCheckEmailRoute: AuthCheckEmailRoute,
AuthSignInRoute: AuthSignInRoute,
AuthSignUpRoute: AuthSignUpRoute,
- AuthAcceptInvitationInviteIdRoute: AuthAcceptInvitationInviteIdRoute,
+ AuthVerifyOtpRoute: AuthVerifyOtpRoute,
}
const AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)
@@ -899,6 +919,7 @@ const rootRouteChildren: RootRouteChildren = {
AuthRoute: AuthRouteWithChildren,
TestErrorRoute: TestErrorRoute,
PublicProjectProjectIdRoute: PublicProjectProjectIdRoute,
+ InvitationAcceptInviteIdRoute: InvitationAcceptInviteIdRoute,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/index.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/index.tsx
index fda3c9cfc..606f197a9 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/index.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/index.tsx
@@ -1,47 +1,20 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import getWorkspaces from "@/fetchers/workspace/get-workspaces";
import { authClient } from "@/lib/auth-client";
-import { useUserPreferencesStore } from "@/store/user-preferences";
import type Workspace from "@/types/workspace";
export const Route = createFileRoute("/_layout/_authenticated/dashboard/")({
beforeLoad: async () => {
const workspaces: Workspace[] = await getWorkspaces();
- const pendingInvitation = document.cookie
- .split(";")
- .find((cookie) => cookie.trim().startsWith("pending_invitation="))
- ?.split("=")[1];
-
- if (pendingInvitation) {
- const { data } = await authClient.organization.acceptInvitation({
- invitationId: pendingInvitation,
- });
-
- authClient.organization.setActive({
- organizationId: data?.invitation.organizationId,
- });
-
- // biome-ignore lint/suspicious/noDocumentCookie: we need to set the cookie to the invite id
- document.cookie =
- "pending_invitation=; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT";
-
- throw redirect({
- to: "/dashboard/workspace/$workspaceId",
- params: { workspaceId: data?.invitation.organizationId || "" },
- });
- }
-
- const { activeWorkspaceId } = useUserPreferencesStore.getState();
+ const session = await authClient.getSession();
+ const activeWorkspaceId = session?.data?.session?.activeOrganizationId;
if (workspaces && workspaces.length > 0) {
if (
activeWorkspaceId &&
workspaces.some((ws) => ws.id === activeWorkspaceId)
) {
- authClient.organization.setActive({
- organizationId: activeWorkspaceId,
- });
throw redirect({
to: "/dashboard/workspace/$workspaceId",
params: { workspaceId: activeWorkspaceId },
@@ -50,10 +23,6 @@ export const Route = createFileRoute("/_layout/_authenticated/dashboard/")({
const firstWorkspace = workspaces[0];
- useUserPreferencesStore.setState({
- activeWorkspaceId: firstWorkspace.id,
- });
-
authClient.organization.setActive({
organizationId: firstWorkspace.id,
});
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/backlog.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/backlog.tsx
index c779e8fe8..32665e406 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/backlog.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/backlog.tsx
@@ -1,5 +1,5 @@
import { useQueryClient } from "@tanstack/react-query";
-import { createFileRoute } from "@tanstack/react-router";
+import { createFileRoute, useNavigate } from "@tanstack/react-router";
import { produce } from "immer";
import { ArrowRight, Calendar, Filter, Plus, User, X } from "lucide-react";
import { useCallback, useEffect, useMemo, useState } from "react";
@@ -8,6 +8,7 @@ import BacklogListView from "@/components/backlog-list-view";
import ProjectLayout from "@/components/common/project-layout";
import PageTitle from "@/components/page-title";
import CreateTaskModal from "@/components/shared/modals/create-task-modal";
+import TaskDetailsSheet from "@/components/task/task-details-sheet";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import {
@@ -30,14 +31,23 @@ import { getPriorityIcon } from "@/lib/priority";
import useProjectStore from "@/store/project";
import type Task from "@/types/task";
+type BacklogSearchParams = {
+ taskId?: string;
+};
+
export const Route = createFileRoute(
"/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/backlog",
)({
component: RouteComponent,
+ validateSearch: (search: Record<string, unknown>): BacklogSearchParams => ({
+ taskId: typeof search.taskId === "string" ? search.taskId : undefined,
+ }),
});
function RouteComponent() {
const { projectId, workspaceId } = Route.useParams();
+ const { taskId } = Route.useSearch();
+ const navigate = useNavigate();
const { data } = useGetTasks(projectId);
const { project, setProject } = useProjectStore();
const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);
@@ -47,6 +57,14 @@ function RouteComponent() {
const { data: workspaceLabels = [] } = useGetLabelsByWorkspace(workspaceId);
const queryClient = useQueryClient();
+ const handleCloseTaskSheet = useCallback(() => {
+ navigate({
+ to: ".",
+ search: {},
+ replace: true,
+ });
+ }, [navigate]);
+
const [filters, setFilters] = useState({
priority: null as string | null,
assignee: null as string | null,
@@ -276,7 +294,7 @@ function RouteComponent() {
return (
<ProjectLayout projectId={projectId} workspaceId={workspaceId}>
<PageTitle title={`${project?.name}'s backlog`} />
- <div className="flex flex-col h-full min-h-0">
+ <div className="relative flex flex-col h-full min-h-0 overflow-hidden">
<div className="bg-card border-b border-border">
<div className="h-10 flex items-center px-4">
<div className="flex items-center justify-between w-full">
@@ -566,6 +584,13 @@ function RouteComponent() {
onClose={() => setIsTaskModalOpen(false)}
status="planned"
/>
+
+ <TaskDetailsSheet
+ taskId={taskId}
+ projectId={projectId}
+ workspaceId={workspaceId}
+ onClose={handleCloseTaskSheet}
+ />
</div>
</ProjectLayout>
);
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/board.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/board.tsx
index c49abc285..5814291c1 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/board.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/board.tsx
@@ -1,4 +1,4 @@
-import { createFileRoute } from "@tanstack/react-router";
+import { createFileRoute, useNavigate } from "@tanstack/react-router";
import {
Calendar,
Filter,
@@ -8,12 +8,13 @@ import {
User,
X,
} from "lucide-react";
-import { useEffect, useState } from "react";
+import { useCallback, useEffect, useState } from "react";
import ProjectLayout from "@/components/common/project-layout";
import KanbanBoard from "@/components/kanban-board";
import ListView from "@/components/list-view";
import PageTitle from "@/components/page-title";
import CreateTaskModal from "@/components/shared/modals/create-task-modal";
+import TaskDetailsSheet from "@/components/task/task-details-sheet";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import {
@@ -37,14 +38,23 @@ import { getPriorityIcon } from "@/lib/priority";
import useProjectStore from "@/store/project";
import { useUserPreferencesStore } from "@/store/user-preferences";
+type BoardSearchParams = {
+ taskId?: string;
+};
+
export const Route = createFileRoute(
"/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/board",
)({
component: RouteComponent,
+ validateSearch: (search: Record<string, unknown>): BoardSearchParams => ({
+ taskId: typeof search.taskId === "string" ? search.taskId : undefined,
+ }),
});
function RouteComponent() {
const { projectId, workspaceId } = Route.useParams();
+ const { taskId } = Route.useSearch();
+ const navigate = useNavigate();
const { data } = useGetTasks(projectId);
const { project, setProject } = useProjectStore();
const { viewMode, setViewMode } = useUserPreferencesStore();
@@ -53,6 +63,14 @@ function RouteComponent() {
const { data: users } = useGetActiveWorkspaceUsers(workspaceId);
const { data: workspaceLabels = [] } = useGetLabelsByWorkspace(workspaceId);
+ const handleCloseTaskSheet = useCallback(() => {
+ navigate({
+ to: ".",
+ search: {},
+ replace: true,
+ });
+ }, [navigate]);
+
useEffect(() => {
if (data) {
setProject(data);
@@ -140,7 +158,7 @@ function RouteComponent() {
title={`${project?.name} — ${viewMode === "board" ? "Board" : "List"}`}
hideAppName
/>
- <div className="flex flex-col h-full min-h-0">
+ <div className="relative flex flex-col h-full min-h-0 overflow-hidden">
<div className="bg-card border-b border-border">
<div className="h-10 flex items-center px-4">
<div className="flex items-center justify-between w-full">
@@ -487,6 +505,13 @@ function RouteComponent() {
open={isTaskModalOpen}
onClose={() => setIsTaskModalOpen(false)}
/>
+
+ <TaskDetailsSheet
+ taskId={taskId}
+ projectId={projectId}
+ workspaceId={workspaceId}
+ onClose={handleCloseTaskSheet}
+ />
</div>
</ProjectLayout>
);
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
index 463eedbba..bec8c1542 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
@@ -1,49 +1,10 @@
import { createFileRoute } from "@tanstack/react-router";
-import { format } from "date-fns";
-import {
- Calendar,
- CalendarClock,
- CalendarX,
- Copy,
- GitBranch,
- Plus,
-} from "lucide-react";
-import { toast } from "sonner";
-import Activity from "@/components/activity";
-import CommentInput from "@/components/activity/comment-input";
import TaskLayout from "@/components/common/task-layout";
-import { ExternalLinksAccordion } from "@/components/external-links/external-links-accordion";
import PageTitle from "@/components/page-title";
-import useAuth from "@/components/providers/auth-provider/hooks/use-auth";
-import TaskAssigneePopover from "@/components/task/task-assignee-popover";
-import TaskDescription from "@/components/task/task-description";
-import TaskDueDatePopover from "@/components/task/task-due-date-popover";
-import TaskLabelsPopover from "@/components/task/task-labels-popover";
-import TaskPriorityPopover from "@/components/task/task-priority-popover";
-import TaskStatusPopover from "@/components/task/task-status-popover";
-import TaskTitle from "@/components/task/task-title";
-import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
-import { Badge } from "@/components/ui/badge";
-import { Button } from "@/components/ui/button";
-import { KbdSequence } from "@/components/ui/kbd";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip";
-import labelColors from "@/constants/label-colors";
-import useGetActivitiesByTaskId from "@/hooks/queries/activity/use-get-activities-by-task-id";
-import useExternalLinks from "@/hooks/queries/external-link/use-external-links";
-import useGetGithubIntegration from "@/hooks/queries/github-integration/use-get-github-integration";
-import useGetLabelsByTask from "@/hooks/queries/label/use-get-labels-by-task";
+import TaskDetailsContent from "@/components/task/task-details-content";
+import TaskPropertiesSidebar from "@/components/task/task-properties-sidebar";
import useGetProject from "@/hooks/queries/project/use-get-project";
import useGetTask from "@/hooks/queries/task/use-get-task";
-import { useGetActiveWorkspaceUsers } from "@/hooks/queries/workspace-users/use-get-active-workspace-users";
-import { getColumnIcon } from "@/lib/column";
-import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";
-import { getPriorityIcon } from "@/lib/priority";
-import type { ExternalLink } from "@/types/external-link";
export const Route = createFileRoute(
"/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_",
@@ -51,73 +12,10 @@ export const Route = createFileRoute(
component: RouteComponent,
});
-function slugify(text: string | undefined): string {
- if (!text) return "";
- return text
- .toLowerCase()
- .replace(/[^a-z0-9]+/g, "-")
- .replace(/^-|-$/g, "")
- .slice(0, 50);
-}
-
-function generateBranchName(
- pattern: string,
- projectSlug: string | undefined,
- taskNumber: number | null | undefined,
- taskTitle: string | undefined,
-): string {
- if (!projectSlug || !taskNumber) return "";
- return pattern
- .replace("{slug}", projectSlug.toLowerCase())
- .replace("{number}", taskNumber.toString())
- .replace("{title}", slugify(taskTitle));
-}
-
-function toNormalCase(str: string | undefined) {
- if (!str) return str;
- return str
- .replace(/[-_]/g, " ")
- .split(" ")
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
- .join(" ");
-}
-
function RouteComponent() {
const { projectId, workspaceId, taskId } = Route.useParams();
const { data: task } = useGetTask(taskId);
const { data: project } = useGetProject({ id: projectId, workspaceId });
- const { data: workspaceUsers } = useGetActiveWorkspaceUsers(workspaceId);
- const { data: taskLabels = [] } = useGetLabelsByTask(taskId);
- const { data: activities = [] } = useGetActivitiesByTaskId(taskId);
- const { data: externalLinks = [], isLoading: isLoadingExternalLinks } =
- useExternalLinks(taskId);
- const { data: githubIntegration } = useGetGithubIntegration(projectId);
- const { user } = useAuth();
- const projectSlug = project?.slug;
- const taskNumber = task?.number;
- const branchPattern = githubIntegration?.branchPattern || "{slug}-{number}";
-
- const assignee = workspaceUsers?.members?.find(
- (member) => member.userId === task?.userId,
- );
-
- const handleCopyTaskLink = () => {
- navigator.clipboard.writeText(
- `${window.location.origin}/workspace/${workspaceId}/project/${projectId}/task/${taskId}`,
- );
- toast.message("Task link copied to clipboard");
- };
-
- const handleCopyTaskBranch = () => {
- const branchName = generateBranchName(
- branchPattern,
- projectSlug,
- taskNumber,
- task?.title,
- );
- navigator.clipboard.writeText(branchName);
- toast.message("Task branch copied to clipboard");
- };
return (
<TaskLayout
@@ -125,250 +23,24 @@ function RouteComponent() {
projectId={projectId}
workspaceId={workspaceId}
rightSidebar={
- <div className="w-72 bg-sidebar border-l border-border flex flex-col gap-2 sticky top-0 right-0">
- <div className="flex gap-2 p-4 px-6">
- <p className="text-sm font-medium text-muted-foreground flex-1">
- Properties
- </p>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- size="xs"
- className="text-muted-foreground"
- onClick={() => handleCopyTaskLink()}
- >
- <Copy className="size-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <KbdSequence
- keys={["Ctrl", "Shift", "C"]}
- description="Copy task link"
- separator=""
- />
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- size="xs"
- className="text-muted-foreground"
- onClick={() => handleCopyTaskBranch()}
- >
- <GitBranch className="size-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <KbdSequence
- keys={["Ctrl", "Shift", "G"]}
- description="Copy task branch"
- separator=""
- />
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- <div className="flex flex-col gap-2 items-start px-4">
- {task && (
- <TaskStatusPopover task={task}>
- <Button
- variant="ghost"
- size="sm"
- className="w-2/4 justify-start"
- >
- {getColumnIcon(task.status ?? "")}
- <span className="text-xs font-semibold">
- {toNormalCase(task.status)}
- </span>
- </Button>
- </TaskStatusPopover>
- )}
- {task && (
- <TaskPriorityPopover task={task}>
- <Button
- variant="ghost"
- size="sm"
- className="w-2/4 justify-start"
- >
- {getPriorityIcon(task.priority ?? "")}
- <span className="text-xs font-semibold">
- {toNormalCase(task.priority ?? "")}
- </span>
- </Button>
- </TaskPriorityPopover>
- )}
- {task && (
- <TaskAssigneePopover task={task} workspaceId={workspaceId}>
- <Button
- variant="ghost"
- size="sm"
- className="w-2/4 justify-start pl-3"
- >
- {task.userId ? (
- <Avatar className="h-[20px] w-[20px]">
- <AvatarImage
- src={assignee?.user?.image ?? ""}
- alt={assignee?.user?.name || ""}
- />
- <AvatarFallback className="text-xs font-medium border border-border/30 flex-shrink-0 h-[20px] w-[20px]">
- {assignee?.user?.name?.charAt(0).toUpperCase()}
- </AvatarFallback>
- </Avatar>
- ) : (
- <div
- className="w-[20px] h-[20px] rounded-full bg-muted border border-border flex items-center justify-center flex-shrink-0"
- title="Unassigned"
- >
- <span className="text-[10px] font-medium">?</span>
- </div>
- )}
- <span className="text-xs font-semibold flex-shrink-0">
- {assignee?.user?.name || task.assigneeName || "Unassigned"}
- </span>
- </Button>
- </TaskAssigneePopover>
- )}
- </div>
- <div className="w-full h-[1px] bg-border my-2" />
- <div className="px-4 pb-4 flex flex-col gap-4">
- <div className="flex flex-col gap-1">
- <div className="flex items-center justify-between">
- <span className="text-xs font-medium text-muted-foreground pl-2">
- Due date
- </span>
- </div>
- {task && (
- <TaskDueDatePopover task={task}>
- <Button
- variant="ghost"
- size="sm"
- className="w-2/4 justify-start"
- >
- {task.dueDate ? (
- <>
- {getDueDateStatus(task.dueDate) === "overdue" && (
- <CalendarX
- className={`w-2 h-2 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}
- />
- )}
- {getDueDateStatus(task.dueDate) === "due-soon" && (
- <CalendarClock
- className={`w-2 h-2 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}
- />
- )}
- {(getDueDateStatus(task.dueDate) === "far-future" ||
- getDueDateStatus(task.dueDate) === "no-due-date") && (
- <Calendar
- className={`w-2 h-2 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}
- />
- )}
- <span className="text-xs font-semibold flex-shrink-0">
- {format(new Date(task.dueDate), "MMM d, yyyy")}
- </span>
- </>
- ) : (
- <span className="text-sm font-semibold">No due date</span>
- )}
- </Button>
- </TaskDueDatePopover>
- )}
- </div>
- <div className="flex flex-col gap-1">
- <div className="flex items-center justify-between">
- <span className="text-xs font-medium text-muted-foreground pl-2">
- Labels
- </span>
- </div>
- <div className="flex flex-wrap items-center gap-2 px-2">
- {task &&
- taskLabels.length > 0 &&
- taskLabels.map(
- (label: { id: string; name: string; color: string }) => (
- <TaskLabelsPopover
- key={`edit-${label.id}`}
- task={task}
- workspaceId={workspaceId}
- >
- <Badge
- key={label.id}
- variant="outline"
- className="flex items-center gap-1.5 px-2 py-1 cursor-pointer hover:bg-accent/50 transition-colors"
- >
- <span
- className="w-2 h-2 rounded-full flex-shrink-0"
- style={{
- backgroundColor:
- labelColors.find((c) => c.value === label.color)
- ?.color || "#94a3b8",
- }}
- />
- <span className="text-xs">{label.name}</span>
- </Badge>
- </TaskLabelsPopover>
- ),
- )}
-
- {task && (
- <TaskLabelsPopover task={task} workspaceId={workspaceId}>
- <Button
- variant="ghost"
- size="sm"
- className="h-6 w-6 p-0 rounded-full border-border hover:border-solid"
- >
- <Plus className="h-3 w-3" />
- </Button>
- </TaskLabelsPopover>
- )}
- </div>
- </div>
- </div>
- </div>
+ <TaskPropertiesSidebar
+ taskId={taskId}
+ projectId={projectId}
+ workspaceId={workspaceId}
+ className="w-full lg:w-56 xl:w-64 h-full bg-sidebar border-b lg:border-b-0 lg:border-l border-border flex flex-col gap-2"
+ />
}
>
<PageTitle
title={`${project?.slug}-${task?.number} — ${task?.title}`}
hideAppName
/>
- <div className="flex flex-col h-full min-h-0 max-w-3xl mx-auto px-4 py-8 gap-2">
- <p className="text-xs font-semibold text-muted-foreground">
- {project?.slug}-{task?.number}
- </p>
- <TaskTitle taskId={taskId} />
- <TaskDescription taskId={taskId} />
- {!isLoadingExternalLinks && externalLinks.length > 0 && (
- <div className="mt-4">
- <ExternalLinksAccordion
- externalLinks={externalLinks as ExternalLink[]}
- isLoading={isLoadingExternalLinks}
- />
- </div>
- )}
- <span className="text-sm font-medium text-muted-foreground h-[1px] bg-border w-full" />
- <div className="flex flex-col gap-4 pt-8">
- <h1 className="text-md font-semibold">Activity</h1>
- {user?.id && <CommentInput taskId={taskId} />}
- <div className="flex flex-col">
- {activities.length === 0 && (
- <p className="text-sm font-medium text-muted-foreground">
- No activity found
- </p>
- )}
- {activities.map((activity, index) => (
- <Activity
- key={activity.id}
- activity={activity}
- isLast={index === activities.length - 1}
- />
- ))}
- </div>
- </div>
- </div>
+ <TaskDetailsContent
+ taskId={taskId}
+ projectId={projectId}
+ workspaceId={workspaceId}
+ className="flex flex-col h-full min-h-0 max-w-3xl mx-auto px-3 sm:px-4 py-4 sm:py-8 gap-2"
+ />
</TaskLayout>
);
}
diff --git a/apps/web/src/routes/auth/accept-invitation/$inviteId.tsx b/apps/web/src/routes/auth/accept-invitation/$inviteId.tsx
deleted file mode 100644
index f83dff1a3..000000000
--- a/apps/web/src/routes/auth/accept-invitation/$inviteId.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-import { createFileRoute, Link, useParams } from "@tanstack/react-router";
-import { Mail, Users } from "lucide-react";
-import { useEffect } from "react";
-import PageTitle from "@/components/page-title";
-import { Button } from "@/components/ui/button";
-import { AuthLayout } from "../../../components/auth/layout";
-
-export const Route = createFileRoute("/auth/accept-invitation/$inviteId")({
- component: AcceptInvitation,
-});
-
-function AcceptInvitation() {
- const { inviteId } = useParams({ from: "/auth/accept-invitation/$inviteId" });
-
- useEffect(() => {
- // biome-ignore lint/suspicious/noDocumentCookie: we need to set the cookie to the invite id
- document.cookie = `pending_invitation=${inviteId}; path=/; max-age=3600`;
- }, [inviteId]);
-
- return (
- <>
- <PageTitle title="Accept Invitation" />
- <AuthLayout title="You've been invited!">
- <div className="space-y-4 mt-4">
- <div className="flex items-center justify-center w-12 h-12 mx-auto bg-primary/10 rounded-full">
- <Users className="w-6 h-6 text-primary" />
- </div>
-
- <div className="space-y-3 text-center">
- <h2 className="text-lg font-semibold text-foreground">
- Join the team
- </h2>
- <div className="space-y-2">
- <p className="text-sm text-muted-foreground leading-relaxed">
- You've been invited to join an organization on Kaneo.
- </p>
- <p className="text-sm text-muted-foreground leading-relaxed">
- Please sign in or create an account to accept this invitation.
- </p>
- </div>
- </div>
-
- <div className="space-y-3 pt-2">
- <Button asChild className="w-full">
- <Link to="/auth/sign-in">
- <Mail className="w-4 h-4 mr-2" />
- Sign in to accept invitation
- </Link>
- </Button>
- </div>
-
- <div className="pt-4 border-t border-border">
- <div className="text-center">
- <p className="text-xs text-muted-foreground">
- Invitation ID: <span className="font-mono">{inviteId}</span>
- </p>
- </div>
- </div>
- </div>
- </AuthLayout>
- </>
- );
-}
diff --git a/apps/web/src/routes/auth/sign-in.tsx b/apps/web/src/routes/auth/sign-in.tsx
index 4e9b2c69f..f3266b304 100644
--- a/apps/web/src/routes/auth/sign-in.tsx
+++ b/apps/web/src/routes/auth/sign-in.tsx
@@ -1,24 +1,37 @@
-import { createFileRoute, useNavigate } from "@tanstack/react-router";
+import {
+ createFileRoute,
+ useNavigate,
+ useSearch,
+} from "@tanstack/react-router";
import { Github, KeyRound, UserCheck } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
+import { z } from "zod/v4";
import PageTitle from "@/components/page-title";
+import { Alert, AlertDescription } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import useGetConfig from "@/hooks/queries/config/use-get-config";
import { authClient } from "@/lib/auth-client";
import { cn } from "@/lib/cn";
import { AuthLayout } from "../../components/auth/layout";
-import { MagicLinkSignInForm } from "../../components/auth/magic-link-sign-in-form";
+import { OtpSignInForm } from "../../components/auth/otp-sign-in-form";
import { SignInForm } from "../../components/auth/sign-in-form";
import { SignInFormSkeleton } from "../../components/auth/sign-in-form-skeleton";
import { AuthToggle } from "../../components/auth/toggle";
+const signInSearchSchema = z.object({
+ invitationId: z.string().optional(),
+ email: z.string().optional(),
+});
+
export const Route = createFileRoute("/auth/sign-in")({
component: SignIn,
+ validateSearch: signInSearchSchema,
});
function SignIn() {
const navigate = useNavigate();
+ const search = useSearch({ from: "/auth/sign-in" });
const [isCustomOAuthLoading, setIsCustomOAuthLoading] = useState(false);
const [isGithubLoading, setIsGithubLoading] = useState(false);
const [isGoogleLoading, setIsGoogleLoading] = useState(false);
@@ -27,6 +40,16 @@ function SignIn() {
const lastLoginMethod = authClient.getLastUsedLoginMethod();
const { data: config, isLoading: isConfigLoading } = useGetConfig();
+ const invitationId = search.invitationId;
+
+ const getCallbackUrl = () => {
+ const baseUrl = import.meta.env.VITE_CLIENT_URL;
+ if (invitationId) {
+ return `${baseUrl}/invitation/accept/${invitationId}`;
+ }
+ return `${baseUrl}/dashboard`;
+ };
+
const handleGuestAccess = async () => {
setIsGuestLoading(true);
try {
@@ -50,14 +73,12 @@ function SignIn() {
try {
const result = await authClient.signIn.oauth2({
providerId: "custom",
- callbackURL: `${import.meta.env.VITE_CLIENT_URL}/dashboard`,
+ callbackURL: getCallbackUrl(),
errorCallbackURL: `${import.meta.env.VITE_CLIENT_URL}/auth/sign-in`,
});
if (result.error) {
throw new Error(result.error.message);
}
- toast.success("Signed in with OIDC");
- navigate({ to: "/dashboard" });
} catch (error) {
toast.error(
error instanceof Error ? error.message : "Failed to sign in with OIDC",
@@ -72,14 +93,12 @@ function SignIn() {
try {
const result = await authClient.signIn.social({
provider: "google",
- callbackURL: `${import.meta.env.VITE_CLIENT_URL}/dashboard`,
+ callbackURL: getCallbackUrl(),
errorCallbackURL: `${import.meta.env.VITE_CLIENT_URL}/auth/sign-in`,
});
if (result.error) {
throw new Error(result.error.message);
}
- toast.success("Signed in with Google");
- navigate({ to: "/dashboard" });
} catch (error) {
toast.error(
error instanceof Error
@@ -96,15 +115,12 @@ function SignIn() {
try {
const result = await authClient.signIn.social({
provider: "github",
- callbackURL: `${import.meta.env.VITE_CLIENT_URL}/dashboard`,
+ callbackURL: getCallbackUrl(),
errorCallbackURL: `${import.meta.env.VITE_CLIENT_URL}/auth/sign-in`,
});
if (result.error) {
throw new Error(result.error.message);
}
- toast.success("Signed in with Github");
- navigate({ to: "/dashboard" });
- setIsGithubLoading(false);
} catch (error) {
toast.error(
error instanceof Error
@@ -121,14 +137,12 @@ function SignIn() {
try {
const result = await authClient.signIn.social({
provider: "discord",
- callbackURL: `${import.meta.env.VITE_CLIENT_URL}/dashboard`,
+ callbackURL: getCallbackUrl(),
errorCallbackURL: `${import.meta.env.VITE_CLIENT_URL}/auth/sign-in`,
});
if (result.error) {
throw new Error(result.error.message);
}
- toast.success("Signed in with Discord");
- navigate({ to: "/dashboard" });
} catch (error) {
toast.error(
error instanceof Error
@@ -140,6 +154,14 @@ function SignIn() {
}
};
+ const handleSignInSuccess = () => {
+ if (invitationId) {
+ navigate({ to: `/invitation/accept/${invitationId}` });
+ } else {
+ navigate({ to: "/dashboard" });
+ }
+ };
+
if (isConfigLoading) {
return (
<>
@@ -159,9 +181,22 @@ function SignIn() {
<PageTitle title="Sign In" />
<AuthLayout
title="Welcome back"
- subtitle="Enter your credentials to access your workspace"
+ subtitle={
+ invitationId
+ ? "Sign in to accept your invitation"
+ : "Enter your credentials to access your workspace"
+ }
>
<div className="mt-6">
+ {invitationId && (
+ <Alert className="mb-4">
+ <AlertDescription>
+ After signing in, you'll be able to accept your workspace
+ invitation.
+ </AlertDescription>
+ </Alert>
+ )}
+
{(config?.hasGoogleSignIn ||
config?.hasGithubSignIn ||
config?.hasDiscordSignIn ||
@@ -284,7 +319,7 @@ function SignIn() {
</div>
)}
- {config?.hasGuestAccess && (
+ {config?.hasGuestAccess && !invitationId && (
<Button
variant="outline"
onClick={handleGuestAccess}
@@ -307,7 +342,14 @@ function SignIn() {
</div>
</>
)}
- {config?.hasSmtp ? <MagicLinkSignInForm /> : <SignInForm />}
+ {config?.hasSmtp ? (
+ <OtpSignInForm
+ invitationId={invitationId}
+ onSuccess={handleSignInSuccess}
+ />
+ ) : (
+ <SignInForm onSuccess={handleSignInSuccess} />
+ )}
<AuthToggle
message="Don't have an account?"
linkText="Create account"
diff --git a/apps/web/src/routes/auth/sign-up.tsx b/apps/web/src/routes/auth/sign-up.tsx
index bd1bd1780..e5b2fcaea 100644
--- a/apps/web/src/routes/auth/sign-up.tsx
+++ b/apps/web/src/routes/auth/sign-up.tsx
@@ -1,32 +1,50 @@
-import { createFileRoute, redirect, useNavigate } from "@tanstack/react-router";
+import {
+ createFileRoute,
+ redirect,
+ useNavigate,
+ useSearch,
+} from "@tanstack/react-router";
import { UserCheck } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
+import { z } from "zod/v4";
import { AuthLayout } from "@/components/auth/layout";
import { SignUpForm } from "@/components/auth/sign-up-form";
import { AuthToggle } from "@/components/auth/toggle";
import PageTitle from "@/components/page-title";
+import { Alert, AlertDescription } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { getConfig } from "@/fetchers/config/get-config";
import useGetConfig from "@/hooks/queries/config/use-get-config";
import { authClient } from "@/lib/auth-client";
+const signUpSearchSchema = z.object({
+ invitationId: z.string().optional(),
+ email: z.string().optional(),
+});
+
export const Route = createFileRoute("/auth/sign-up")({
component: SignUp,
- beforeLoad: async () => {
+ validateSearch: signUpSearchSchema,
+ beforeLoad: async ({ search }) => {
const config = await getConfig();
- if (config.disableRegistration) {
- redirect({ to: "/auth/sign-in", replace: true });
+ const hasInvitation = !!search.invitationId;
+ if (config.disableRegistration && !hasInvitation) {
+ throw redirect({ to: "/auth/sign-in", replace: true });
}
},
});
function SignUp() {
const navigate = useNavigate();
+ const search = useSearch({ from: "/auth/sign-up" });
const [isGuestLoading, setIsGuestLoading] = useState(false);
const { data: config } = useGetConfig();
+ const invitationId = search.invitationId;
+ const prefillEmail = search.email;
+
const handleGuestAccess = async () => {
setIsGuestLoading(true);
try {
@@ -50,31 +68,44 @@ function SignUp() {
<PageTitle title="Create Account" />
<AuthLayout
title="Create account"
- subtitle="Get started with your workspace"
+ subtitle={
+ invitationId
+ ? "Create an account to accept your invitation"
+ : "Get started with your workspace"
+ }
>
<div className="space-y-4 mt-6">
- {config?.hasGuestAccess && (
- <Button
- variant="outline"
- onClick={handleGuestAccess}
- disabled={isGuestLoading}
- className="w-full mb-0"
- size="sm"
- >
- <UserCheck className="w-4 h-4 mr-2" />
- {isGuestLoading ? "Signing in..." : "Continue as guest"}
- </Button>
+ {invitationId && (
+ <Alert>
+ <AlertDescription>
+ After creating your account, you'll be able to accept your
+ workspace invitation.
+ </AlertDescription>
+ </Alert>
)}
- {config?.hasGuestAccess && (
- <div className="flex items-center gap-4 my-4">
- <div className="flex-1 h-px bg-zinc-200 dark:bg-zinc-800" />
- <span className="text-sm text-zinc-500 dark:text-zinc-400">
- or
- </span>
- <div className="flex-1 h-px bg-zinc-200 dark:bg-zinc-800" />
- </div>
+
+ {config?.hasGuestAccess && !invitationId && (
+ <>
+ <Button
+ variant="outline"
+ onClick={handleGuestAccess}
+ disabled={isGuestLoading}
+ className="w-full mb-0"
+ size="sm"
+ >
+ <UserCheck className="w-4 h-4 mr-2" />
+ {isGuestLoading ? "Signing in..." : "Continue as guest"}
+ </Button>
+ <div className="flex items-center gap-4 my-4">
+ <div className="flex-1 h-px bg-zinc-200 dark:bg-zinc-800" />
+ <span className="text-sm text-zinc-500 dark:text-zinc-400">
+ or
+ </span>
+ <div className="flex-1 h-px bg-zinc-200 dark:bg-zinc-800" />
+ </div>
+ </>
)}
- <SignUpForm />
+ <SignUpForm invitationId={invitationId} defaultEmail={prefillEmail} />
<AuthToggle
message="Already have an account?"
linkText="Sign in"
diff --git a/apps/web/src/routes/auth/verify-otp.tsx b/apps/web/src/routes/auth/verify-otp.tsx
new file mode 100644
index 000000000..e5bcce659
--- /dev/null
+++ b/apps/web/src/routes/auth/verify-otp.tsx
@@ -0,0 +1,167 @@
+import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
+import { createFileRoute, useRouter, useSearch } from "@tanstack/react-router";
+import { useState } from "react";
+import { useForm } from "react-hook-form";
+import { toast } from "sonner";
+import { z } from "zod/v4";
+import PageTitle from "@/components/page-title";
+import { Button } from "@/components/ui/button";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { Input } from "@/components/ui/input";
+import { authClient } from "@/lib/auth-client";
+import { AuthLayout } from "../../components/auth/layout";
+
+const verifyOtpSchema = z.object({
+ otp: z.string().length(6, "Code must be 6 digits"),
+});
+
+type VerifyOtpFormValues = z.infer<typeof verifyOtpSchema>;
+
+export const Route = createFileRoute("/auth/verify-otp")({
+ component: VerifyOtp,
+ validateSearch: (search: Record<string, unknown>) => ({
+ email: search.email as string,
+ invitationId: search.invitationId as string | undefined,
+ }),
+});
+
+function VerifyOtp() {
+ const { history } = useRouter();
+ const { email, invitationId } = useSearch({ from: "/auth/verify-otp" });
+ const [isPending, setIsPending] = useState(false);
+
+ const form = useForm<VerifyOtpFormValues>({
+ resolver: standardSchemaResolver(verifyOtpSchema),
+ defaultValues: { otp: "" },
+ });
+
+ const onSubmit = async (data: VerifyOtpFormValues) => {
+ setIsPending(true);
+ try {
+ const result = await authClient.signIn.emailOtp({
+ email,
+ otp: data.otp,
+ });
+
+ if (result.error) {
+ toast.error(result.error.message || "Invalid verification code");
+ return;
+ }
+
+ toast.success("Signed in successfully!");
+ if (invitationId) {
+ history.push(`/invitation/accept/${invitationId}`);
+ } else {
+ history.push("/dashboard");
+ }
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to verify code",
+ );
+ } finally {
+ setIsPending(false);
+ }
+ };
+
+ const handleResendOtp = async () => {
+ setIsPending(true);
+ try {
+ const result = await authClient.emailOtp.sendVerificationOtp({
+ email,
+ type: "sign-in",
+ });
+
+ if (result.error) {
+ toast.error(result.error.message || "Failed to resend code");
+ return;
+ }
+
+ toast.success("New verification code sent!");
+ form.reset();
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to resend code",
+ );
+ } finally {
+ setIsPending(false);
+ }
+ };
+
+ return (
+ <>
+ <PageTitle title="Verify Code" />
+ <AuthLayout title="Enter verification code">
+ <div className="mt-4">
+ <div className="text-center space-y-2 mb-6">
+ <p className="text-sm text-muted-foreground">
+ Enter the 6-digit code sent to
+ </p>
+ <p className="text-sm font-medium">{email}</p>
+ </div>
+
+ <Form {...form}>
+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
+ <FormField
+ control={form.control}
+ name="otp"
+ render={({ field, fieldState }) => (
+ <FormItem>
+ <FormLabel className="text-sm font-medium sr-only">
+ Verification Code
+ </FormLabel>
+ <FormControl>
+ <Input
+ placeholder="123456"
+ type="text"
+ inputMode="numeric"
+ pattern="[0-9]*"
+ maxLength={6}
+ autoComplete="one-time-code"
+ className="text-center text-2xl tracking-[0.5em] font-mono"
+ {...field}
+ />
+ </FormControl>
+ <FormMessage>{fieldState.error?.message}</FormMessage>
+ </FormItem>
+ )}
+ />
+
+ <Button
+ type="submit"
+ disabled={isPending}
+ className="w-full text-white"
+ >
+ {isPending ? "Verifying..." : "Verify & Sign In"}
+ </Button>
+
+ <div className="flex items-center justify-between text-sm">
+ <button
+ type="button"
+ onClick={() => history.push("/auth/sign-in")}
+ className="text-muted-foreground hover:text-foreground"
+ >
+ Change email
+ </button>
+ <button
+ type="button"
+ onClick={handleResendOtp}
+ disabled={isPending}
+ className="text-primary hover:underline"
+ >
+ Resend code
+ </button>
+ </div>
+ </form>
+ </Form>
+ </div>
+ </AuthLayout>
+ </>
+ );
+}
diff --git a/apps/web/src/routes/invitation/accept.$inviteId.tsx b/apps/web/src/routes/invitation/accept.$inviteId.tsx
new file mode 100644
index 000000000..2dd0ebc7c
--- /dev/null
+++ b/apps/web/src/routes/invitation/accept.$inviteId.tsx
@@ -0,0 +1,295 @@
+import {
+ createFileRoute,
+ Link,
+ useNavigate,
+ useParams,
+} from "@tanstack/react-router";
+import {
+ AlertCircle,
+ CheckCircle,
+ Clock,
+ Loader2,
+ LogIn,
+ Users,
+ XCircle,
+} from "lucide-react";
+import { useState } from "react";
+import { toast } from "sonner";
+import PageTitle from "@/components/page-title";
+import { Alert, AlertDescription } from "@/components/ui/alert";
+import { Button } from "@/components/ui/button";
+import { useGetInvitationDetails } from "@/hooks/queries/invitation/use-get-invitation-details";
+import { authClient } from "@/lib/auth-client";
+import { AuthLayout } from "../../components/auth/layout";
+
+export const Route = createFileRoute("/invitation/accept/$inviteId")({
+ component: AcceptInvitation,
+});
+
+function AcceptInvitation() {
+ const { inviteId } = useParams({
+ from: "/invitation/accept/$inviteId",
+ });
+ const navigate = useNavigate();
+ const [isAccepting, setIsAccepting] = useState(false);
+
+ const { data: session, isPending: isSessionLoading } =
+ authClient.useSession();
+ const {
+ data: invitationData,
+ isLoading: isInvitationLoading,
+ error: invitationError,
+ } = useGetInvitationDetails(inviteId);
+
+ const isLoading = isSessionLoading || isInvitationLoading;
+ const isSignedIn = !!session?.user;
+
+ const handleAcceptInvitation = async () => {
+ setIsAccepting(true);
+ try {
+ const { data, error } = await authClient.organization.acceptInvitation({
+ invitationId: inviteId,
+ });
+
+ if (error) {
+ toast.error(error.message || "Failed to accept invitation");
+ return;
+ }
+
+ await authClient.organization.setActive({
+ organizationId: data?.invitation.organizationId,
+ });
+
+ toast.success("Invitation accepted! Welcome to the team.");
+
+ if (!session?.user?.name) {
+ navigate({ to: "/profile-setup" });
+ return;
+ }
+
+ navigate({
+ to: "/dashboard/workspace/$workspaceId",
+ params: { workspaceId: data?.invitation.organizationId || "" },
+ });
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to accept invitation",
+ );
+ } finally {
+ setIsAccepting(false);
+ }
+ };
+
+ const handleSignIn = async () => {
+ const email = invitationData?.invitation?.email;
+ if (!email) {
+ navigate({ to: "/auth/sign-in", search: { invitationId: inviteId } });
+ return;
+ }
+
+ try {
+ const result = await authClient.emailOtp.sendVerificationOtp({
+ email,
+ type: "sign-in",
+ });
+
+ if (result.error) {
+ toast.error(result.error.message || "Failed to send verification code");
+ navigate({
+ to: "/auth/sign-in",
+ search: { invitationId: inviteId, email },
+ });
+ return;
+ }
+
+ toast.success("Verification code sent! Check your email.");
+ navigate({
+ to: "/auth/verify-otp",
+ search: { email, invitationId: inviteId },
+ });
+ } catch {
+ toast.error(
+ "Failed to send verification code. Please try signing in manually.",
+ );
+ navigate({
+ to: "/auth/sign-in",
+ search: { invitationId: inviteId, email },
+ });
+ }
+ };
+
+ if (isLoading) {
+ return (
+ <>
+ <PageTitle title="Accept Invitation" />
+ <AuthLayout title="Loading invitation...">
+ <div className="flex items-center justify-center py-8">
+ <Loader2 className="w-6 h-6 animate-spin text-primary" />
+ </div>
+ </AuthLayout>
+ </>
+ );
+ }
+
+ if (invitationError || !invitationData) {
+ return (
+ <>
+ <PageTitle title="Invitation Error" />
+ <AuthLayout title="Invitation Error">
+ <div className="space-y-4 mt-4">
+ <div className="flex items-center justify-center w-12 h-12 mx-auto bg-destructive/10 rounded-full">
+ <XCircle className="w-6 h-6 text-destructive" />
+ </div>
+ <Alert variant="destructive">
+ <AlertCircle className="h-4 w-4" />
+ <AlertDescription>
+ Failed to load invitation details. The invitation may be invalid
+ or expired.
+ </AlertDescription>
+ </Alert>
+ <Button asChild variant="outline" className="w-full">
+ <Link to="/auth/sign-in">Go to Sign In</Link>
+ </Button>
+ </div>
+ </AuthLayout>
+ </>
+ );
+ }
+
+ if (!invitationData.valid) {
+ return (
+ <>
+ <PageTitle title="Invalid Invitation" />
+ <AuthLayout title="Invalid Invitation">
+ <div className="space-y-4 mt-4">
+ <div className="flex items-center justify-center w-12 h-12 mx-auto bg-destructive/10 rounded-full">
+ {invitationData.invitation?.expired ? (
+ <Clock className="w-6 h-6 text-destructive" />
+ ) : (
+ <XCircle className="w-6 h-6 text-destructive" />
+ )}
+ </div>
+
+ <div className="space-y-3 text-center">
+ <h2 className="text-lg font-semibold text-foreground">
+ {invitationData.invitation?.expired
+ ? "Invitation Expired"
+ : "Invalid Invitation"}
+ </h2>
+ <p className="text-sm text-muted-foreground">
+ {invitationData.error}
+ </p>
+ {invitationData.invitation && (
+ <p className="text-xs text-muted-foreground">
+ Workspace: {invitationData.invitation.workspaceName}
+ </p>
+ )}
+ </div>
+
+ <Button asChild variant="outline" className="w-full">
+ <Link to="/auth/sign-in">Go to Sign In</Link>
+ </Button>
+ </div>
+ </AuthLayout>
+ </>
+ );
+ }
+
+ const invitation = invitationData.invitation!;
+
+ if (isSignedIn) {
+ return (
+ <>
+ <PageTitle title="Accept Invitation" />
+ <AuthLayout title="Accept Invitation">
+ <div className="space-y-4 mt-4">
+ <div className="flex items-center justify-center w-12 h-12 mx-auto bg-primary/10 rounded-full">
+ <Users className="w-6 h-6 text-primary" />
+ </div>
+
+ <div className="space-y-3 text-center">
+ <h2 className="text-lg font-semibold text-foreground">
+ Join {invitation.workspaceName}
+ </h2>
+ <p className="text-sm text-muted-foreground">
+ <strong>{invitation.inviterName}</strong> has invited you to
+ join their workspace.
+ </p>
+ </div>
+
+ <div className="space-y-3 pt-2">
+ <Button
+ onClick={handleAcceptInvitation}
+ disabled={isAccepting}
+ className="w-full"
+ >
+ {isAccepting ? (
+ <>
+ <Loader2 className="w-4 h-4 mr-2 animate-spin" />
+ Accepting...
+ </>
+ ) : (
+ <>
+ <CheckCircle className="w-4 h-4 mr-2" />
+ Accept Invitation
+ </>
+ )}
+ </Button>
+
+ <Button asChild variant="outline" className="w-full">
+ <Link to="/dashboard">Go to Dashboard</Link>
+ </Button>
+ </div>
+
+ <div className="pt-4 border-t border-border">
+ <p className="text-xs text-center text-muted-foreground">
+ Signed in as <strong>{session.user.email}</strong>
+ </p>
+ </div>
+ </div>
+ </AuthLayout>
+ </>
+ );
+ }
+
+ return (
+ <>
+ <PageTitle title="Accept Invitation" />
+ <AuthLayout title="You've been invited!">
+ <div className="space-y-4 mt-4">
+ <div className="flex items-center justify-center w-12 h-12 mx-auto bg-primary/10 rounded-full">
+ <Users className="w-6 h-6 text-primary" />
+ </div>
+
+ <div className="space-y-3 text-center">
+ <h2 className="text-lg font-semibold text-foreground">
+ Join {invitation.workspaceName}
+ </h2>
+ <p className="text-sm text-muted-foreground">
+ <strong>{invitation.inviterName}</strong> has invited you to join
+ their workspace on Kaneo.
+ </p>
+ <p className="text-sm text-muted-foreground">
+ Sign in to accept this invitation.
+ </p>
+ </div>
+
+ <div className="space-y-3 pt-2">
+ <Button onClick={handleSignIn} className="w-full">
+ <LogIn className="w-4 h-4 mr-2" />
+ Sign In
+ </Button>
+ </div>
+
+ <div className="pt-4 border-t border-border">
+ <div className="text-center space-y-1">
+ <p className="text-xs text-muted-foreground">
+ Invitation for: <strong>{invitation.email}</strong>
+ </p>
+ </div>
+ </div>
+ </div>
+ </AuthLayout>
+ </>
+ );
+}
diff --git a/apps/web/src/routes/public-project.$projectId.tsx b/apps/web/src/routes/public-project.$projectId.tsx
index 4ad9b7ccc..2dda58e09 100644
--- a/apps/web/src/routes/public-project.$projectId.tsx
+++ b/apps/web/src/routes/public-project.$projectId.tsx
@@ -1,6 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";
-import { Grid3X3, Layout, List } from "lucide-react";
-import { createElement, useState } from "react";
+import { Layout, List } from "lucide-react";
+import { createElement, useEffect, useState } from "react";
import PageTitle from "@/components/page-title";
import { CopyUrlButton } from "@/components/public-project/copy-url-button";
import { ErrorView } from "@/components/public-project/error-view";
@@ -21,13 +21,27 @@ export const Route = createFileRoute("/public-project/$projectId")({
type ViewMode = "kanban" | "list";
+const VIEW_MODE_STORAGE_KEY = "kaneo-public-view-mode";
+
function RouteComponent() {
const { projectId } = Route.useParams();
const { data: project, isLoading, error } = useGetPublicProject(projectId);
- const [viewMode, setViewMode] = useState<ViewMode>("kanban");
+
+ const [viewMode, setViewMode] = useState<ViewMode>(() => {
+ if (typeof window !== "undefined") {
+ const saved = localStorage.getItem(VIEW_MODE_STORAGE_KEY);
+ return (saved as ViewMode) || "kanban";
+ }
+ return "kanban";
+ });
+
const [selectedTask, setSelectedTask] = useState<Task | null>(null);
const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);
+ useEffect(() => {
+ localStorage.setItem(VIEW_MODE_STORAGE_KEY, viewMode);
+ }, [viewMode]);
+
const handleTaskClick = (task: Task) => {
setSelectedTask(task);
setIsTaskModalOpen(true);
@@ -49,58 +63,58 @@ function RouteComponent() {
return (
<>
<PageTitle title="Public View" />
- <div className="min-h-screen bg-zinc-50 dark:bg-zinc-900 flex flex-col w-full">
- <header className="bg-white dark:bg-zinc-900 border-b border-zinc-200 dark:border-zinc-800 sticky top-0 z-10 backdrop-blur-sm bg-white/95 dark:bg-zinc-900/95">
- <div className="px-6 py-4">
- <div className="flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4">
- <div className="space-y-3 flex-1">
- <div className="flex items-center gap-3 flex-wrap">
- <div className="w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg">
- {createElement(
- icons[project.icon as keyof typeof icons] || Layout,
- {
- className: "w-6 h-6 shrink-0",
- },
- )}
- </div>
- <div className="flex items-center gap-3 flex-wrap">
- <h1 className="text-2xl font-bold text-zinc-900 dark:text-zinc-100">
+ <div className="min-h-screen bg-background flex flex-col w-full">
+ <header className="border-b border-border sticky top-0 z-10 bg-background">
+ <div className="px-6 py-2.5">
+ <div className="flex items-center justify-between gap-4">
+ <div className="flex items-center gap-3 flex-1 min-w-0">
+ <div className="w-9 h-9 rounded-lg bg-muted flex items-center justify-center shrink-0">
+ {createElement(
+ icons[project.icon as keyof typeof icons] || Layout,
+ {
+ className: "w-5 h-5 text-muted-foreground",
+ },
+ )}
+ </div>
+ <div className="flex flex-col gap-1 min-w-0">
+ <div className="flex items-center gap-2">
+ <h1 className="text-lg font-semibold text-foreground truncate">
{project.name}
</h1>
- <span className="px-3 py-1 text-sm bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded-full font-medium border border-green-200 dark:border-green-800">
- Public View
+ <span className="px-1.5 py-0.5 text-[10px] bg-muted text-muted-foreground rounded font-medium shrink-0">
+ Public
</span>
</div>
+ {project.description && (
+ <p className="text-xs text-muted-foreground truncate">
+ {project.description}
+ </p>
+ )}
</div>
- {project.description && (
- <p className="text-zinc-600 dark:text-zinc-400 max-w-3xl leading-relaxed">
- {project.description}
- </p>
- )}
</div>
- <div className="flex items-center gap-3 lg:flex-shrink-0">
+ <div className="flex items-center gap-2 shrink-0">
<CopyUrlButton />
<ThemeToggle />
- <div className="h-6 w-px bg-zinc-200 dark:bg-zinc-700" />
- <div className="flex items-center gap-2">
+ <div className="h-4 w-px bg-border" />
+ <div className="flex items-center gap-1">
<Button
- variant={viewMode === "kanban" ? "default" : "outline"}
+ variant="ghost"
size="sm"
onClick={() => setViewMode("kanban")}
- className="gap-2"
+ className={`h-8 gap-2 ${viewMode === "kanban" ? "bg-accent" : ""}`}
>
- <Grid3X3 className="w-4 h-4" />
- Board
+ <Layout className="h-3 w-3" />
+ <span className="text-xs">Board</span>
</Button>
<Button
- variant={viewMode === "list" ? "default" : "outline"}
+ variant="ghost"
size="sm"
onClick={() => setViewMode("list")}
- className="gap-2"
+ className={`h-8 gap-2 ${viewMode === "list" ? "bg-accent" : ""}`}
>
- <List className="w-4 h-4" />
- List
+ <List className="h-3 w-3" />
+ <span className="text-xs">List</span>
</Button>
</div>
</div>
@@ -116,13 +130,11 @@ function RouteComponent() {
)}
</main>
- <footer className="bg-white dark:bg-zinc-900 border-t border-zinc-200 dark:border-zinc-800 py-4">
- <div className="px-6">
- <div className="flex flex-col md:flex-row items-center justify-between gap-4">
+ <footer className="border-t border-border">
+ <div className="px-6 py-3">
+ <div className="flex items-center justify-between text-xs text-muted-foreground">
<KaneoBranding />
- <p className="text-sm text-zinc-500 dark:text-zinc-400 text-center md:text-right">
- This is a read-only public view of the project.
- </p>
+ <span>Read-only</span>
</div>
</div>
</footer>
diff --git a/packages/email/src/index.tsx b/packages/email/src/index.tsx
index 5c88c753c..c0f8aa7ef 100644
--- a/packages/email/src/index.tsx
+++ b/packages/email/src/index.tsx
@@ -1 +1,5 @@
-export { sendMagicLinkEmail, sendWorkspaceInvitationEmail } from "./send-email";
+export {
+ sendMagicLinkEmail,
+ sendOtpEmail,
+ sendWorkspaceInvitationEmail,
+} from "./send-email";
diff --git a/packages/email/src/send-email.tsx b/packages/email/src/send-email.tsx
index b5c76a5a9..e6dd3c0d6 100644
--- a/packages/email/src/send-email.tsx
+++ b/packages/email/src/send-email.tsx
@@ -3,6 +3,8 @@ import { config } from "dotenv-mono";
import * as nodemailer from "nodemailer";
import type { MagicLinkEmailProps } from "./templates/magic-link";
import MagicLinkEmail from "./templates/magic-link";
+import type { OtpEmailProps } from "./templates/otp";
+import OtpEmail from "./templates/otp";
import WorkspaceInvitationEmail, {
type WorkspaceInvitationEmailProps,
} from "./templates/workspace-invitation";
@@ -38,6 +40,24 @@ export const sendMagicLinkEmail = async (
}
};
+export const sendOtpEmail = async (
+ to: string,
+ subject: string,
+ data: OtpEmailProps,
+) => {
+ const emailTemplate = await render(OtpEmail(data));
+ try {
+ await transporter.sendMail({
+ from: process.env.SMTP_FROM,
+ to,
+ subject,
+ html: emailTemplate,
+ });
+ } catch (error) {
+ console.error("Error sending OTP email", error);
+ }
+};
+
export type EmailResult = {
success: boolean;
reason?: "SMTP_NOT_CONFIGURED";
diff --git a/packages/email/src/templates/otp.tsx b/packages/email/src/templates/otp.tsx
new file mode 100644
index 000000000..b493157c1
--- /dev/null
+++ b/packages/email/src/templates/otp.tsx
@@ -0,0 +1,89 @@
+import {
+ Body,
+ Container,
+ Head,
+ Heading,
+ Hr,
+ Html,
+ Preview,
+ Section,
+ Text,
+} from "@react-email/components";
+import React from "react";
+
+void React;
+
+export type OtpEmailProps = {
+ otp: string;
+};
+
+const OtpEmail = ({ otp }: OtpEmailProps) => (
+ <Html>
+ <Head />
+ <Body style={main}>
+ <Preview>Your verification code for Kaneo</Preview>
+ <Container style={container}>
+ <Heading style={heading}>Your verification code</Heading>
+ <Section style={body}>
+ <Text style={paragraph}>Enter this code to sign in to Kaneo:</Text>
+ <Text style={codeStyle}>{otp}</Text>
+ <Text style={paragraph}>
+ This code will only be valid for the next 5 minutes.
+ </Text>
+ <Text style={paragraph}>
+ If you didn't request this, please ignore this email.
+ </Text>
+ <Hr />
+ <Text style={footerParagraph}>Kaneo</Text>
+ </Section>
+ </Container>
+ </Body>
+ </Html>
+);
+
+OtpEmail.PreviewProps = {
+ otp: "123456",
+} as OtpEmailProps;
+
+export default OtpEmail;
+
+const main = {
+ fontFamily:
+ '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif',
+};
+
+const container = {
+ margin: "0 auto",
+ padding: "20px 25px 0px",
+};
+
+const heading = {
+ fontSize: "28px",
+ fontWeight: "bold",
+};
+
+const body = {
+ margin: "24px 0",
+};
+
+const paragraph = {
+ fontSize: "16px",
+ lineHeight: "26px",
+};
+
+const codeStyle = {
+ fontSize: "32px",
+ fontWeight: "bold",
+ letterSpacing: "6px",
+ textAlign: "center" as const,
+ margin: "24px 0",
+ padding: "16px",
+ backgroundColor: "#f4f4f5",
+ borderRadius: "8px",
+};
+
+const footerParagraph = {
+ fontSize: "14px",
+ lineHeight: "20px",
+ color: "#6B7280",
+};
diff --git a/packages/email/src/templates/workspace-invitation.tsx b/packages/email/src/templates/workspace-invitation.tsx
index 48fc4618b..24ee6c16e 100644
--- a/packages/email/src/templates/workspace-invitation.tsx
+++ b/packages/email/src/templates/workspace-invitation.tsx
@@ -34,19 +34,20 @@ const WorkspaceInvitationEmail = ({
<Body style={main}>
<Preview>You've been invited to join {workspaceName} on Kaneo.</Preview>
<Container style={container}>
- <Heading style={heading}>🎉 You're invited to {workspaceName}</Heading>
+ <Heading style={heading}>Join {workspaceName}</Heading>
<Section style={body}>
<Text style={paragraph}>
- <strong>{inviterName}</strong> ({inviterEmail}) has invited you to
- join the <strong>{workspaceName}</strong> workspace on Kaneo.
+ {inviterName} ({inviterEmail}) has invited you to join{" "}
+ {workspaceName} on Kaneo.
</Text>
<Text style={paragraph}>
- <Link style={link} href={`${invitationLink}?email=${to}`}>
- 👉 Accept invitation 👈
- </Link>
+ Click the button below to accept the invitation:
</Text>
+ <Link style={buttonStyle} href={`${invitationLink}?email=${to}`}>
+ Accept Invitation
+ </Link>
<Text style={paragraph}>
- If you didn't request this, please ignore this email.
+ If you didn't expect this invitation, you can ignore this email.
</Text>
<Hr />
<Text style={footerParagraph}>Kaneo</Text>
@@ -61,6 +62,7 @@ WorkspaceInvitationEmail.PreviewProps = {
inviterName: "John Doe",
inviterEmail: "[email protected]",
invitationLink: "https://kaneo.app/invite/abc123",
} as WorkspaceInvitationEmailProps;
export default WorkspaceInvitationEmail;
@@ -75,10 +77,6 @@ const container = {
padding: "20px 25px 0px",
};
-const _header = {
- display: "inline-block",
-};
-
const heading = {
fontSize: "28px",
fontWeight: "bold",
@@ -93,8 +91,17 @@ const paragraph = {
lineHeight: "26px",
};
-const link = {
- color: "#5463FF",
+const buttonStyle = {
+ display: "inline-block",
+ fontSize: "16px",
+ fontWeight: "600",
+ textAlign: "center" as const,
+ textDecoration: "none",
+ padding: "12px 24px",
+ margin: "24px 0",
+ backgroundColor: "#18181b",
+ color: "#ffffff",
+ borderRadius: "8px",
};
const footerParagraph = {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c5e4ae4fe..d39a752cc 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -71,7 +71,7 @@ importers:
version: 6.0.0
better-auth:
specifier: ^1.4.10
croner:
specifier: ^9.1.0
version: 9.1.0
@@ -313,7 +313,7 @@ importers:
version: 19.0.0-beta-ebf51a3-20250411
better-auth:
specifier: ^1.4.10
class-variance-authority:
specifier: ^0.7.1
version: 0.7.1
@@ -353,6 +353,9 @@ importers:
react-hook-form:
specifier: ^7.70.0
version: 7.70.0([email protected])
+ react-markdown:
+ specifier: ^10.1.0
+ version: 10.1.0(@types/[email protected])([email protected])
react-use-websocket:
specifier: ^4.11.1
version: 4.13.0
@@ -4481,6 +4484,9 @@ packages:
resolution: {integrity: sha512-qY60FjREgVZL03vJU6IfMV4GDjGBIoOyvuFdpBDIX9yTlDw0TjxVBQp+P8NvpdIXNJvfWBTNul7fsAQJq2FNpg==}
engines: {node: '>=14'}
+ resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==}
+
resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}
@@ -5442,6 +5448,12 @@ packages:
peerDependencies:
react: '*'
+ resolution: {integrity: sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==}
+ peerDependencies:
+ '@types/react': '>=18'
+ react: '>=18'
+
resolution: {integrity: sha512-BsE+EnFVQzFIlyuuQrZ9iTwyKpKkqdFZV1ImEQN573QPqGrIUuNni7aF+sZwDcxlsuOMayCr6oO/PZR/yJnbRg==}
peerDependencies:
@@ -9558,7 +9570,7 @@ snapshots:
dependencies:
@@ -10534,6 +10546,8 @@ snapshots:
htmlparser2: 8.0.2
selderee: 0.11.0
+
@@ -11699,6 +11713,24 @@ snapshots:
dependencies:
react: 19.2.3
+ dependencies:
+ '@types/hast': 3.0.4
+ '@types/mdast': 4.0.4
+ '@types/react': 19.2.7
+ devlop: 1.1.0
+ hast-util-to-jsx-runtime: 2.3.6
+ html-url-attributes: 3.0.1
+ mdast-util-to-hast: 13.2.1
+ react: 19.2.3
+ remark-parse: 11.0.0
+ remark-rehype: 11.1.2
+ unified: 11.0.5
+ unist-util-visit: 5.0.0
+ vfile: 6.0.3
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
react: 19.2.3