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.

style: :sparkles: formatting project with biome

Andreje80cf100eb6e
diff --git a/apps/api/package.json b/apps/api/package.json
index d87f4d4da..bf6a3a1f1 100644
--- a/apps/api/package.json
+++ b/apps/api/package.json
@@ -1,29 +1,29 @@
{
- "name": "@kaneo/api",
- "version": "1.0.50",
- "main": "./src/index.ts",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1",
- "dev": "bun run --watch src/index.ts"
- },
- "dependencies": {
- "@elysiajs/cors": "^1.2.0",
- "@elysiajs/jwt": "^1.2.0",
- "@elysiajs/websocket": "^0.2.8",
- "@paralleldrive/cuid2": "^2.2.2",
- "better-sqlite3": "^11.7.0",
- "drizzle-kit": "^0.30.1",
- "drizzle-orm": "^0.38.3",
- "drizzle-typebox": "^0.2.1",
- "elysia": "latest",
- "@kaneo/typescript-config": "workspace:*"
- },
- "devDependencies": {
- "bun-types": "latest"
- },
- "override": {
- "@sinclair/typebox": "0.32.4"
- },
- "module": "src/index.ts",
- "type": "module"
+ "name": "@kaneo/api",
+ "version": "1.0.50",
+ "main": "./src/index.ts",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "dev": "bun run --watch src/index.ts"
+ },
+ "dependencies": {
+ "@elysiajs/cors": "^1.2.0",
+ "@elysiajs/jwt": "^1.2.0",
+ "@elysiajs/websocket": "^0.2.8",
+ "@paralleldrive/cuid2": "^2.2.2",
+ "better-sqlite3": "^11.7.0",
+ "drizzle-kit": "^0.30.1",
+ "drizzle-orm": "^0.38.3",
+ "drizzle-typebox": "^0.2.1",
+ "elysia": "latest",
+ "@kaneo/typescript-config": "workspace:*"
+ },
+ "devDependencies": {
+ "bun-types": "latest"
+ },
+ "override": {
+ "@sinclair/typebox": "0.32.4"
+ },
+ "module": "src/index.ts",
+ "type": "module"
}
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index dd09e65bf..f240c0e62 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -2,13 +2,13 @@ import { createId } from "@paralleldrive/cuid2";
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
export const userTable = sqliteTable("user", {
- id: text("id")
- .$defaultFn(() => createId())
- .primaryKey(),
- name: text("name").notNull().unique(),
- password: text("password").notNull(),
- email: text("email").notNull().unique(),
- createdAt: integer("created_at", { mode: "timestamp" })
- .default(new Date())
- .notNull(),
+ id: text("id")
+ .$defaultFn(() => createId())
+ .primaryKey(),
+ name: text("name").notNull().unique(),
+ password: text("password").notNull(),
+ email: text("email").notNull().unique(),
+ createdAt: integer("created_at", { mode: "timestamp" })
+ .default(new Date())
+ .notNull(),
});
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index da8e3da0c..7f2028165 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -5,46 +5,46 @@ import { REFRESH_TOKEN_EXPIRY } from "./user/constants";
import createToken from "./user/utils/create-token";
const app = new Elysia()
- .use(cors())
- .use(user)
- .guard({
- async beforeHandle({
- set,
- accessJwt,
- refreshJwt,
- cookie: { accessToken, refreshToken },
- }) {
- const decodedAccessToken = await accessJwt.verify(accessToken.value);
- const decodedRefreshToken = await refreshJwt.verify(refreshToken.value);
-
- if (!decodedAccessToken) {
- set.status = "Unauthorized";
-
- return set.status;
- }
-
- if (!decodedRefreshToken) {
- const refreshToken = await createToken({
- jwt: refreshJwt,
- expires: REFRESH_TOKEN_EXPIRY,
- payload: {
- id: String(decodedAccessToken.id),
- },
- });
-
- if (set.cookie) set.cookie.refreshToken = refreshToken;
- }
- },
- })
- .get("/me", async ({ refreshJwt, cookie: { refreshToken } }) => {
- const profile = await refreshJwt.verify(refreshToken.value);
-
- return profile;
- })
- .listen(1337);
+ .use(cors())
+ .use(user)
+ .guard({
+ async beforeHandle({
+ set,
+ accessJwt,
+ refreshJwt,
+ cookie: { accessToken, refreshToken },
+ }) {
+ const decodedAccessToken = await accessJwt.verify(accessToken.value);
+ const decodedRefreshToken = await refreshJwt.verify(refreshToken.value);
+
+ if (!decodedAccessToken) {
+ set.status = "Unauthorized";
+
+ return set.status;
+ }
+
+ if (!decodedRefreshToken) {
+ const refreshToken = await createToken({
+ jwt: refreshJwt,
+ expires: REFRESH_TOKEN_EXPIRY,
+ payload: {
+ id: String(decodedAccessToken.id),
+ },
+ });
+
+ if (set.cookie) set.cookie.refreshToken = refreshToken;
+ }
+ },
+ })
+ .get("/me", async ({ refreshJwt, cookie: { refreshToken } }) => {
+ const profile = await refreshJwt.verify(refreshToken.value);
+
+ return profile;
+ })
+ .listen(1337);
export type App = typeof app;
console.log(
- `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`,
+ `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
);
diff --git a/apps/api/src/tsconfig.json b/apps/api/src/tsconfig.json
index eb284dc52..2ca47bba9 100644
--- a/apps/api/src/tsconfig.json
+++ b/apps/api/src/tsconfig.json
@@ -1,105 +1,105 @@
{
- "compilerOptions": {
- /* Visit https://aka.ms/tsconfig to read more about this file */
+ "compilerOptions": {
+ /* Visit https://aka.ms/tsconfig to read more about this file */
- /* Projects */
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
+ /* Projects */
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
- /* Language and Environment */
- "target": "ES2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
- // "jsx": "preserve", /* Specify what JSX code is generated. */
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
+ /* Language and Environment */
+ "target": "ES2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
- /* Modules */
- "module": "ES2022" /* Specify what module code is generated. */,
- // "rootDir": "./", /* Specify the root folder within your source files. */
- "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
- "types": [
- "bun-types"
- ] /* Specify type package names to be included without being referenced in a source file. */,
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
- // "resolveJsonModule": true, /* Enable importing .json files. */
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
+ /* Modules */
+ "module": "ES2022" /* Specify what module code is generated. */,
+ // "rootDir": "./", /* Specify the root folder within your source files. */
+ "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
+ "types": [
+ "bun-types"
+ ] /* Specify type package names to be included without being referenced in a source file. */,
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
+ // "resolveJsonModule": true, /* Enable importing .json files. */
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
- /* JavaScript Support */
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
+ /* JavaScript Support */
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
- /* Emit */
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
- // "outDir": "./", /* Specify an output folder for all emitted files. */
- // "removeComments": true, /* Disable emitting comments. */
- // "noEmit": true, /* Disable emitting files from a compilation. */
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
- // "newLine": "crlf", /* Set the newline character for emitting files. */
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
+ /* Emit */
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
+ // "removeComments": true, /* Disable emitting comments. */
+ // "noEmit": true, /* Disable emitting files from a compilation. */
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
- /* Interop Constraints */
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
+ /* Interop Constraints */
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
- /* Type Checking */
- "strict": true /* Enable all strict type-checking options. */,
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
+ /* Type Checking */
+ "strict": true /* Enable all strict type-checking options. */,
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
- /* Completeness */
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
- }
+ /* Completeness */
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
+ }
}
diff --git a/apps/api/src/user/constants.ts b/apps/api/src/user/constants.ts
index 85360d6ad..c375ff305 100644
--- a/apps/api/src/user/constants.ts
+++ b/apps/api/src/user/constants.ts
@@ -1,7 +1,7 @@
export const ACCESS_TOKEN_EXPIRY = new Date(
- Date.now() + 30 * 24 * 60 * 60 * 1000, // 30d
+ Date.now() + 30 * 24 * 60 * 60 * 1000 // 30d
);
export const REFRESH_TOKEN_EXPIRY = new Date(
- new Date(Date.now() + 15 * 60 * 1000), // 15m
+ new Date(Date.now() + 15 * 60 * 1000) // 15m
);
diff --git a/apps/api/src/user/controllers/sign-in.ts b/apps/api/src/user/controllers/sign-in.ts
index 596560bc5..198af24d3 100644
--- a/apps/api/src/user/controllers/sign-in.ts
+++ b/apps/api/src/user/controllers/sign-in.ts
@@ -6,28 +6,28 @@ import { UserErrors } from "../errors";
type SignInArgs = Static<typeof signInUserSchema>;
async function signIn({
- email,
- password,
+ email,
+ password,
}: Pick<SignInArgs, "email" | "password">) {
- const user = await db.query.userTable.findFirst({
- where: (users, { eq }) => eq(users.email, email),
- });
+ const user = await db.query.userTable.findFirst({
+ where: (users, { eq }) => eq(users.email, email),
+ });
- if (!user) {
- throw new Error(UserErrors.NotFound);
- }
+ if (!user) {
+ throw new Error(UserErrors.NotFound);
+ }
- const isPasswordValid = await Bun.password.verify(
- password,
- user.password,
- "bcrypt",
- );
+ const isPasswordValid = await Bun.password.verify(
+ password,
+ user.password,
+ "bcrypt"
+ );
- if (!isPasswordValid) {
- throw new Error(UserErrors.InvalidCredentials);
- }
+ if (!isPasswordValid) {
+ throw new Error(UserErrors.InvalidCredentials);
+ }
- return user;
+ return user;
}
export default signIn;
diff --git a/apps/api/src/user/controllers/sign-up.ts b/apps/api/src/user/controllers/sign-up.ts
index 2f24316d2..b29136434 100644
--- a/apps/api/src/user/controllers/sign-up.ts
+++ b/apps/api/src/user/controllers/sign-up.ts
@@ -7,25 +7,25 @@ import { UserErrors } from "../errors";
type SignUpArgs = Static<typeof signUpUserSchema>;
async function signUp({ email, name, password }: SignUpArgs) {
- const isEmailTaken = Boolean(
- await db.query.userTable.findFirst({
- where: (users, { eq }) => eq(users.email, email),
- }),
- );
+ const isEmailTaken = Boolean(
+ await db.query.userTable.findFirst({
+ where: (users, { eq }) => eq(users.email, email),
+ })
+ );
- if (isEmailTaken) {
- throw new Error(UserErrors.EmailTaken);
- }
+ if (isEmailTaken) {
+ throw new Error(UserErrors.EmailTaken);
+ }
- const hashedPassword = await Bun.password.hash(password, {
- algorithm: "bcrypt",
- });
+ const hashedPassword = await Bun.password.hash(password, {
+ algorithm: "bcrypt",
+ });
- const user = await db
- .insert(userTable)
- .values({ email, name, password: hashedPassword });
+ const user = await db
+ .insert(userTable)
+ .values({ email, name, password: hashedPassword });
- return user;
+ return user;
}
export default signUp;
diff --git a/apps/api/src/user/db/queries.ts b/apps/api/src/user/db/queries.ts
index 9f9c5749d..8610621ae 100644
--- a/apps/api/src/user/db/queries.ts
+++ b/apps/api/src/user/db/queries.ts
@@ -3,12 +3,12 @@ import { t } from "elysia";
import { userTable } from "../../database/schema";
export const signUpUserSchema = createInsertSchema(userTable, {
- email: t.String({ format: "email" }),
- password: t.String(),
- name: t.String(),
+ email: t.String({ format: "email" }),
+ password: t.String(),
+ name: t.String(),
});
export const signInUserSchema = createSelectSchema(userTable, {
- email: t.String({ format: "email" }),
- password: t.String(),
+ email: t.String({ format: "email" }),
+ password: t.String(),
});
diff --git a/apps/api/src/user/errors.ts b/apps/api/src/user/errors.ts
index 99eb7d2e4..27c650351 100644
--- a/apps/api/src/user/errors.ts
+++ b/apps/api/src/user/errors.ts
@@ -1,5 +1,5 @@
export enum UserErrors {
- NotFound = "UserError: NotFound",
- EmailTaken = "UserError: EmailTaken",
- InvalidCredentials = "UserError: InvalidCredentials",
+ NotFound = "UserError: NotFound",
+ EmailTaken = "UserError: EmailTaken",
+ InvalidCredentials = "UserError: InvalidCredentials",
}
diff --git a/apps/api/src/user/index.ts b/apps/api/src/user/index.ts
index bbf345ac0..d5c08f9aa 100644
--- a/apps/api/src/user/index.ts
+++ b/apps/api/src/user/index.ts
@@ -7,60 +7,60 @@ import { signInUserSchema, signUpUserSchema } from "./db/queries";
import createToken from "./utils/create-token";
const user = new Elysia({ prefix: "/user" })
- .use(
- jwt({
- name: "accessJwt",
- secret: process.env.JWT_ACCESS ?? "",
- }),
- )
- .use(
- jwt({
- name: "refreshJwt",
- secret: process.env.JWT_REFRESH ?? "",
- }),
- )
- .post(
- "/sign-in",
- async ({ body, accessJwt, refreshJwt, set }) => {
- const user = await signIn(body);
+ .use(
+ jwt({
+ name: "accessJwt",
+ secret: process.env.JWT_ACCESS ?? "",
+ })
+ )
+ .use(
+ jwt({
+ name: "refreshJwt",
+ secret: process.env.JWT_REFRESH ?? "",
+ })
+ )
+ .post(
+ "/sign-in",
+ async ({ body, accessJwt, refreshJwt, set }) => {
+ const user = await signIn(body);
- const accessToken = await createToken({
- expires: ACCESS_TOKEN_EXPIRY,
- jwt: accessJwt,
- payload: {
- id: user.id,
- },
- });
+ const accessToken = await createToken({
+ expires: ACCESS_TOKEN_EXPIRY,
+ jwt: accessJwt,
+ payload: {
+ id: user.id,
+ },
+ });
- const refreshToken = await createToken({
- expires: REFRESH_TOKEN_EXPIRY,
- jwt: refreshJwt,
- payload: {
- id: user.id,
- },
- });
+ const refreshToken = await createToken({
+ expires: REFRESH_TOKEN_EXPIRY,
+ jwt: refreshJwt,
+ payload: {
+ id: user.id,
+ },
+ });
- set.cookie = {
- accessToken,
- refreshToken,
- };
+ set.cookie = {
+ accessToken,
+ refreshToken,
+ };
- return {
- user,
- };
- },
- {
- body: t.Omit(signInUserSchema, ["id", "name", "createdAt"]),
- },
- )
- .post(
- "/sign-up",
- async ({ body }) => {
- return signUp(body);
- },
- {
- body: signUpUserSchema,
- },
- );
+ return {
+ user,
+ };
+ },
+ {
+ body: t.Omit(signInUserSchema, ["id", "name", "createdAt"]),
+ }
+ )
+ .post(
+ "/sign-up",
+ async ({ body }) => {
+ return signUp(body);
+ },
+ {
+ body: signUpUserSchema,
+ }
+ );
export default user;
diff --git a/apps/api/src/user/utils/create-token.ts b/apps/api/src/user/utils/create-token.ts
index 61cfba4ed..b7956deae 100644
--- a/apps/api/src/user/utils/create-token.ts
+++ b/apps/api/src/user/utils/create-token.ts
@@ -3,20 +3,20 @@ import type { Static } from "elysia";
import type { signInUserSchema } from "../db/queries";
const createToken = async ({
- jwt,
- payload,
- expires,
+ jwt,
+ payload,
+ expires,
}: {
- expires: Date;
- jwt: ReturnType<typeof jwtInstance>;
- payload: Pick<Static<typeof signInUserSchema>, "id">;
+ expires: Date;
+ jwt: ReturnType<typeof jwtInstance>;
+ payload: Pick<Static<typeof signInUserSchema>, "id">;
}) => {
- return {
- value: await jwt.sign(payload),
- httpOnly: true,
- path: "/",
- expires,
- };
+ return {
+ value: await jwt.sign(payload),
+ httpOnly: true,
+ path: "/",
+ expires,
+ };
};
export default createToken;
diff --git a/apps/web/components.json b/apps/web/components.json
index 1589d2eae..275d4164c 100644
--- a/apps/web/components.json
+++ b/apps/web/components.json
@@ -1,21 +1,21 @@
{
- "$schema": "https://ui.shadcn.com/schema.json",
- "style": "new-york",
- "rsc": false,
- "tsx": true,
- "tailwind": {
- "config": "tailwind.config.js",
- "css": "src/index.css",
- "baseColor": "zinc",
- "cssVariables": true,
- "prefix": ""
- },
- "aliases": {
- "components": "@/components",
- "utils": "@/lib/utils",
- "ui": "@/components/ui",
- "lib": "@/lib",
- "hooks": "@/hooks"
- },
- "iconLibrary": "lucide"
+ "$schema": "https://ui.shadcn.com/schema.json",
+ "style": "new-york",
+ "rsc": false,
+ "tsx": true,
+ "tailwind": {
+ "config": "tailwind.config.js",
+ "css": "src/index.css",
+ "baseColor": "zinc",
+ "cssVariables": true,
+ "prefix": ""
+ },
+ "aliases": {
+ "components": "@/components",
+ "utils": "@/lib/utils",
+ "ui": "@/components/ui",
+ "lib": "@/lib",
+ "hooks": "@/hooks"
+ },
+ "iconLibrary": "lucide"
}
diff --git a/apps/web/package.json b/apps/web/package.json
index b0495004a..e29def95e 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -1,43 +1,43 @@
{
- "name": "@kaneo/web",
- "private": true,
- "version": "0.0.0",
- "type": "module",
- "scripts": {
- "dev": "vite",
- "build": "tsc -b && vite build",
- "preview": "vite preview"
- },
- "dependencies": {
- "@hookform/resolvers": "^3.9.1",
- "@radix-ui/react-avatar": "^1.1.2",
- "@radix-ui/react-label": "^2.1.1",
- "@radix-ui/react-slot": "^1.1.1",
- "@tanstack/react-query": "^5.62.11",
- "@tanstack/react-query-devtools": "^5.62.12",
- "@tanstack/react-router": "^1.94.1",
- "class-variance-authority": "^0.7.1",
- "clsx": "^2.1.1",
- "framer-motion": "^11.15.0",
- "lucide-react": "^0.469.0",
- "react": "^18.3.1",
- "react-dom": "^18.3.1",
- "react-hook-form": "^7.54.2",
- "tailwind-merge": "^2.6.0",
- "tailwindcss-animate": "^1.0.7",
- "zod": "link:@hookform/resolvers/zod"
- },
- "devDependencies": {
- "@kaneo/libs": "workspace:*",
- "@types/node": "^22.10.5",
- "@types/react": "^18.3.18",
- "@types/react-dom": "^18.3.5",
- "@vitejs/plugin-react-swc": "^3.5.0",
- "autoprefixer": "^10.4.20",
- "globals": "^15.14.0",
- "postcss": "^8.4.49",
- "tailwindcss": "^3.4.17",
- "typescript": "~5.6.2",
- "vite": "^6.0.5"
- }
+ "name": "@kaneo/web",
+ "private": true,
+ "version": "0.0.0",
+ "type": "module",
+ "scripts": {
+ "dev": "vite",
+ "build": "tsc -b && vite build",
+ "preview": "vite preview"
+ },
+ "dependencies": {
+ "@hookform/resolvers": "^3.9.1",
+ "@radix-ui/react-avatar": "^1.1.2",
+ "@radix-ui/react-label": "^2.1.1",
+ "@radix-ui/react-slot": "^1.1.1",
+ "@tanstack/react-query": "^5.62.11",
+ "@tanstack/react-query-devtools": "^5.62.12",
+ "@tanstack/react-router": "^1.94.1",
+ "class-variance-authority": "^0.7.1",
+ "clsx": "^2.1.1",
+ "framer-motion": "^11.15.0",
+ "lucide-react": "^0.469.0",
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "react-hook-form": "^7.54.2",
+ "tailwind-merge": "^2.6.0",
+ "tailwindcss-animate": "^1.0.7",
+ "zod": "link:@hookform/resolvers/zod"
+ },
+ "devDependencies": {
+ "@kaneo/libs": "workspace:*",
+ "@types/node": "^22.10.5",
+ "@types/react": "^18.3.18",
+ "@types/react-dom": "^18.3.5",
+ "@vitejs/plugin-react-swc": "^3.5.0",
+ "autoprefixer": "^10.4.20",
+ "globals": "^15.14.0",
+ "postcss": "^8.4.49",
+ "tailwindcss": "^3.4.17",
+ "typescript": "~5.6.2",
+ "vite": "^6.0.5"
+ }
}
diff --git a/apps/web/src/components/auth/layout.tsx b/apps/web/src/components/auth/layout.tsx
index 559e0a175..de3aefee9 100644
--- a/apps/web/src/components/auth/layout.tsx
+++ b/apps/web/src/components/auth/layout.tsx
@@ -2,29 +2,29 @@ import { motion } from "framer-motion";
import { Logo } from "../common/logo";
interface AuthLayoutProps {
- children: React.ReactNode;
- title: string;
- subtitle: string;
+ children: React.ReactNode;
+ title: string;
+ subtitle: string;
}
export function AuthLayout({ children, title, subtitle }: AuthLayoutProps) {
- return (
- <div className="min-h-screen bg-gradient-to-b from-zinc-900 to-zinc-950 flex flex-col items-center justify-center p-4">
- <motion.div
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- className="w-full max-w-md"
- >
- <div className="mb-8 text-center">
- <Logo className="mx-auto mb-6" />
- <h1 className="text-3xl font-bold text-zinc-100 mb-2">{title}</h1>
- <p className="text-zinc-400">{subtitle}</p>
- </div>
+ return (
+ <div className="min-h-screen bg-gradient-to-b from-zinc-900 to-zinc-950 flex flex-col items-center justify-center p-4">
+ <motion.div
+ initial={{ opacity: 0, y: 20 }}
+ animate={{ opacity: 1, y: 0 }}
+ className="w-full max-w-md"
+ >
+ <div className="mb-8 text-center">
+ <Logo className="mx-auto mb-6" />
+ <h1 className="text-3xl font-bold text-zinc-100 mb-2">{title}</h1>
+ <p className="text-zinc-400">{subtitle}</p>
+ </div>
- <div className="bg-zinc-900/50 backdrop-blur-xl rounded-xl border border-zinc-800/50 p-6">
- {children}
- </div>
- </motion.div>
- </div>
- );
+ <div className="bg-zinc-900/50 backdrop-blur-xl rounded-xl border border-zinc-800/50 p-6">
+ {children}
+ </div>
+ </motion.div>
+ </div>
+ );
}
diff --git a/apps/web/src/components/auth/sign-in-form.tsx b/apps/web/src/components/auth/sign-in-form.tsx
index 3a354d36b..a29a184af 100644
--- a/apps/web/src/components/auth/sign-in-form.tsx
+++ b/apps/web/src/components/auth/sign-in-form.tsx
@@ -1,3 +1,13 @@
+import { Button } from "@/components/ui/button";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { Input } from "@/components/ui/input";
import { zodResolver } from "@hookform/resolvers/zod";
import { api } from "@kaneo/libs";
import { useMutation } from "@tanstack/react-query";
@@ -6,131 +16,121 @@ import { Eye, EyeOff } from "lucide-react";
import { useState } from "react";
import { useForm } from "react-hook-form";
import { type ZodType, z } from "zod";
-import { Button } from "../ui/button";
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from "../ui/form";
-import { Input } from "../ui/input";
type FormValues = {
- email: string;
- password: string;
+ email: string;
+ password: string;
};
const signInSchema: ZodType<FormValues> = z.object({
- email: z.string().email(),
- password: z
- .string()
- .min(8, { message: "Password is too short" })
- .max(20, { message: "Password is too long" }),
+ email: z.string().email(),
+ password: z
+ .string()
+ .min(8, { message: "Password is too short" })
+ .max(20, { message: "Password is too long" }),
});
export function SignInForm() {
- const [showPassword, setShowPassword] = useState(false);
- const { history } = useRouter();
- const form = useForm<FormValues>({
- resolver: zodResolver(signInSchema),
- defaultValues: {
- email: "",
- password: "",
- },
- });
- const { mutateAsync } = useMutation({
- mutationFn: () =>
- api.user["sign-in"].post({
- email: form.getValues().email,
- password: form.getValues().password,
- }),
- });
+ const [showPassword, setShowPassword] = useState(false);
+ const { history } = useRouter();
+ const form = useForm<FormValues>({
+ resolver: zodResolver(signInSchema),
+ defaultValues: {
+ email: "",
+ password: "",
+ },
+ });
+ const { mutateAsync } = useMutation({
+ mutationFn: () =>
+ api.user["sign-in"].post({
+ email: form.getValues().email,
+ password: form.getValues().password,
+ }),
+ });
- const onSubmit = async () => {
- await mutateAsync();
- history.push("/");
- };
+ const onSubmit = async () => {
+ await mutateAsync();
+ history.push("/");
+ };
- return (
- <Form {...form}>
- <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
- <div className="space-y-4">
- <div>
- <FormField
- control={form.control}
- name="email"
- render={({ field }) => (
- <FormItem>
- <FormLabel className="text-sm font-medium text-zinc-300 mb-1.5 block">
- Email
- </FormLabel>
- <FormControl>
- <Input
- className="bg-zinc-800/50 border-zinc-700/50 text-zinc-100"
- placeholder="[email protected]"
- {...field}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
+ return (
+ <Form {...form}>
+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
+ <div className="space-y-4">
+ <div>
+ <FormField
+ control={form.control}
+ name="email"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel className="text-sm font-medium text-zinc-300 mb-1.5 block">
+ Email
+ </FormLabel>
+ <FormControl>
+ <Input
+ className="bg-zinc-800/50 border-zinc-700/50 text-zinc-100"
+ placeholder="[email protected]"
+ {...field}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
- <div>
- <FormField
- control={form.control}
- name="password"
- render={({ field }) => (
- <FormItem>
- <FormLabel className="text-sm font-medium text-zinc-300 mb-1.5 block">
- Password
- </FormLabel>
- <FormControl>
- <div className="relative">
- <Input
- className="bg-zinc-800/50 border-zinc-700/50 text-zinc-100 pr-10"
- placeholder="••••••••"
- type={showPassword ? "text" : "password"}
- {...field}
- />
- <button
- type="button"
- onClick={() => setShowPassword(!showPassword)}
- className="absolute right-3 top-1/2 -translate-y-1/2 text-zinc-400 hover:text-zinc-300"
- >
- {showPassword ? (
- <EyeOff size={16} />
- ) : (
- <Eye size={16} />
- )}
- </button>
- </div>
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <div className="flex justify-end mt-1">
- <button
- type="button"
- className="text-sm text-zinc-400 hover:text-zinc-300"
- >
- Forgot password?
- </button>
- </div>
- </div>
- </div>
+ <div>
+ <FormField
+ control={form.control}
+ name="password"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel className="text-sm font-medium text-zinc-300 mb-1.5 block">
+ Password
+ </FormLabel>
+ <FormControl>
+ <div className="relative">
+ <Input
+ className="bg-zinc-800/50 border-zinc-700/50 text-zinc-100 pr-10"
+ placeholder="••••••••"
+ type={showPassword ? "text" : "password"}
+ {...field}
+ />
+ <button
+ type="button"
+ onClick={() => setShowPassword(!showPassword)}
+ className="absolute right-3 top-1/2 -translate-y-1/2 text-zinc-400 hover:text-zinc-300"
+ >
+ {showPassword ? (
+ <EyeOff size={16} />
+ ) : (
+ <Eye size={16} />
+ )}
+ </button>
+ </div>
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <div className="flex justify-end mt-1">
+ <button
+ type="button"
+ className="text-sm text-zinc-400 hover:text-zinc-300"
+ >
+ Forgot password?
+ </button>
+ </div>
+ </div>
+ </div>
- <Button
- type="submit"
- className="w-full bg-zinc-100 text-zinc-900 hover:bg-zinc-200 mt-6"
- >
- Sign In
- </Button>
- </form>
- </Form>
- );
+ <Button
+ type="submit"
+ className="w-full bg-zinc-100 text-zinc-900 hover:bg-zinc-200 mt-6"
+ >
+ Sign In
+ </Button>
+ </form>
+ </Form>
+ );
}
diff --git a/apps/web/src/components/auth/toggle.tsx b/apps/web/src/components/auth/toggle.tsx
index 2ae05e2ba..c932d8588 100644
--- a/apps/web/src/components/auth/toggle.tsx
+++ b/apps/web/src/components/auth/toggle.tsx
@@ -1,23 +1,23 @@
import { Link } from "@tanstack/react-router";
interface AuthToggleProps {
- message: string;
- linkText: string;
- linkTo: string;
+ message: string;
+ linkText: string;
+ linkTo: string;
}
export function AuthToggle({ message, linkText, linkTo }: AuthToggleProps) {
- return (
- <div className="mt-6 text-center">
- <p className="text-sm text-zinc-400">
- {message}{" "}
- <Link
- href={linkTo}
- className="text-zinc-300 hover:text-zinc-100 font-medium"
- >
- {linkText}
- </Link>
- </p>
- </div>
- );
+ return (
+ <div className="mt-6 text-center">
+ <p className="text-sm text-zinc-400">
+ {message}{" "}
+ <Link
+ href={linkTo}
+ className="text-zinc-300 hover:text-zinc-100 font-medium"
+ >
+ {linkText}
+ </Link>
+ </p>
+ </div>
+ );
}
diff --git a/apps/web/src/components/common/logo.tsx b/apps/web/src/components/common/logo.tsx
index a4ca56e09..0bba0f94a 100644
--- a/apps/web/src/components/common/logo.tsx
+++ b/apps/web/src/components/common/logo.tsx
@@ -1,18 +1,18 @@
import { LayoutGrid } from "lucide-react";
interface LogoProps {
- className?: string;
+ className?: string;
}
export function Logo({ className = "" }: LogoProps) {
- return (
- <div className={`flex items-center gap-2 ${className}`}>
- <div className="p-1.5 bg-gradient-to-br from-indigo-500 to-purple-500 rounded-lg shadow-sm">
- <LayoutGrid className="w-5 h-5 text-white" />
- </div>
- <span className="text-lg font-semibold bg-gradient-to-br from-indigo-600 to-purple-600 dark:from-indigo-400 dark:to-purple-400 bg-clip-text text-transparent">
- Kaneo
- </span>
- </div>
- );
+ return (
+ <div className={`flex items-center gap-2 ${className}`}>
+ <div className="p-1.5 bg-gradient-to-br from-indigo-500 to-purple-500 rounded-lg shadow-sm">
+ <LayoutGrid className="w-5 h-5 text-white" />
+ </div>
+ <span className="text-lg font-semibold bg-gradient-to-br from-indigo-600 to-purple-600 dark:from-indigo-400 dark:to-purple-400 bg-clip-text text-transparent">
+ Kaneo
+ </span>
+ </div>
+ );
}
diff --git a/apps/web/src/components/common/mobile-header.tsx b/apps/web/src/components/common/mobile-header.tsx
index c51e78a55..bb1977f3d 100644
--- a/apps/web/src/components/common/mobile-header.tsx
+++ b/apps/web/src/components/common/mobile-header.tsx
@@ -2,19 +2,20 @@ import { Menu } from "lucide-react";
import { Logo } from "./logo";
interface MobileHeaderProps {
- onMenuClick: () => void;
+ onMenuClick: () => void;
}
export function MobileHeader({ onMenuClick }: MobileHeaderProps) {
- return (
- <div className="flex items-center justify-between p-4 border-b border-zinc-800 md:hidden">
- <Logo />
- <button
- onClick={onMenuClick}
- className="p-2 text-zinc-400 hover:text-zinc-300 hover:bg-zinc-800 rounded-lg transition-colors"
- >
- <Menu className="h-6 w-6" />
- </button>
- </div>
- );
+ return (
+ <div className="flex items-center justify-between p-4 border-b border-zinc-800 md:hidden">
+ <Logo />
+ <button
+ type="button"
+ onClick={onMenuClick}
+ className="p-2 text-zinc-400 hover:text-zinc-300 hover:bg-zinc-800 rounded-lg transition-colors"
+ >
+ <Menu className="h-6 w-6" />
+ </button>
+ </div>
+ );
}
diff --git a/apps/web/src/components/common/sidebar/index.tsx b/apps/web/src/components/common/sidebar/index.tsx
index 4ad2ab04d..63b00816b 100644
--- a/apps/web/src/components/common/sidebar/index.tsx
+++ b/apps/web/src/components/common/sidebar/index.tsx
@@ -7,60 +7,60 @@ import { SidebarContent } from "./sidebar-content";
import { SidebarHeader } from "./sidebar-header";
export function Sidebar() {
- const [isOpen, setIsOpen] = useState(false);
- // const { workspaces, currentWorkspace, setCurrentWorkspace } = useKaneoStore();
- const currentUser = {
- name: "John Doe",
- email: "[email protected]",
- avatar:
- "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=32&h=32&fit=crop&crop=face",
- };
+ const [isOpen, setIsOpen] = useState(false);
+ // const { workspaces, currentWorkspace, setCurrentWorkspace } = useKaneoStore();
+ const currentUser = {
+ name: "John Doe",
+ email: "[email protected]",
+ avatar:
+ "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=32&h=32&fit=crop&crop=face",
+ };
- return (
- <>
- <MobileHeader onMenuClick={() => setIsOpen(true)} />
+ return (
+ <>
+ <MobileHeader onMenuClick={() => setIsOpen(true)} />
- <div
- className={cn(
- "fixed inset-0 z-40 bg-white/80 dark:bg-zinc-950/80 backdrop-blur-sm md:hidden",
- isOpen ? "opacity-100" : "opacity-0 pointer-events-none",
- )}
- >
- <div
- className={cn(
- "fixed inset-y-0 left-0 w-64 bg-white dark:bg-zinc-900 transform transition-transform duration-200 ease-in-out",
- isOpen ? "translate-x-0" : "-translate-x-full",
- )}
- >
- <div className="flex items-center justify-between p-4 border-b border-zinc-200 dark:border-zinc-800">
- <Logo />
- <button
- type="button"
- onClick={() => setIsOpen(false)}
- className="p-2 text-zinc-500 hover:text-zinc-700 dark:text-zinc-400 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-lg transition-colors"
- >
- <X className="h-5 w-5" />
- </button>
- </div>
+ <div
+ className={cn(
+ "fixed inset-0 z-40 bg-white/80 dark:bg-zinc-950/80 backdrop-blur-sm md:hidden",
+ isOpen ? "opacity-100" : "opacity-0 pointer-events-none"
+ )}
+ >
+ <div
+ className={cn(
+ "fixed inset-y-0 left-0 w-64 bg-white dark:bg-zinc-900 transform transition-transform duration-200 ease-in-out",
+ isOpen ? "translate-x-0" : "-translate-x-full"
+ )}
+ >
+ <div className="flex items-center justify-between p-4 border-b border-zinc-200 dark:border-zinc-800">
+ <Logo />
+ <button
+ type="button"
+ onClick={() => setIsOpen(false)}
+ className="p-2 text-zinc-500 hover:text-zinc-700 dark:text-zinc-400 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-lg transition-colors"
+ >
+ <X className="h-5 w-5" />
+ </button>
+ </div>
- <SidebarContent
- workspaces={[]}
- currentWorkspace={"Andrej's workspace"}
- setCurrentWorkspace={() => {}}
- currentUser={currentUser}
- />
- </div>
- </div>
+ <SidebarContent
+ workspaces={[]}
+ currentWorkspace={"Andrej's workspace"}
+ setCurrentWorkspace={() => {}}
+ currentUser={currentUser}
+ />
+ </div>
+ </div>
- <div className="hidden md:flex w-64 bg-white dark:bg-zinc-900 border-r border-zinc-200 dark:border-zinc-800 h-screen flex-col">
- <SidebarHeader />
- <SidebarContent
- workspaces={[]}
- currentWorkspace={"Andrej's workspace"}
- setCurrentWorkspace={() => {}}
- currentUser={currentUser}
- />
- </div>
- </>
- );
+ <div className="hidden md:flex w-64 bg-white dark:bg-zinc-900 border-r border-zinc-200 dark:border-zinc-800 h-screen flex-col">
+ <SidebarHeader />
+ <SidebarContent
+ workspaces={[]}
+ currentWorkspace={"Andrej's workspace"}
+ setCurrentWorkspace={() => {}}
+ currentUser={currentUser}
+ />
+ </div>
+ </>
+ );
}
diff --git a/apps/web/src/components/common/sidebar/sidebar-content.tsx b/apps/web/src/components/common/sidebar/sidebar-content.tsx
index e61d7dd6e..27db0fcf3 100644
--- a/apps/web/src/components/common/sidebar/sidebar-content.tsx
+++ b/apps/web/src/components/common/sidebar/sidebar-content.tsx
@@ -2,111 +2,111 @@ import { Folder, LogOut, Plus, Settings, Users } from "lucide-react";
import { Avatar, AvatarFallback, AvatarImage } from "../../ui/avatar";
interface SidebarContentProps {
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
- workspaces: any[];
- currentWorkspace: string | null;
- setCurrentWorkspace: (id: string) => void;
- currentUser: {
- name: string;
- email: string;
- avatar: string;
- };
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
+ workspaces: any[];
+ currentWorkspace: string | null;
+ setCurrentWorkspace: (id: string) => void;
+ currentUser: {
+ name: string;
+ email: string;
+ avatar: string;
+ };
}
export function SidebarContent({
- workspaces,
- currentWorkspace,
- setCurrentWorkspace,
- currentUser,
+ workspaces,
+ currentWorkspace,
+ setCurrentWorkspace,
+ currentUser,
}: SidebarContentProps) {
- return (
- <>
- <nav className="flex-1 overflow-y-auto p-3">
- <div className="space-y-4">
- <div>
- <h2 className="text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-2 px-3">
- Workspaces
- </h2>
- <div className="space-y-1">
- {workspaces.map((workspace) => (
- <button
- type="button"
- key={workspace.id}
- onClick={() => setCurrentWorkspace(workspace.id)}
- className={`w-full text-left px-3 py-2 rounded-lg flex items-center transition-colors ${
- currentWorkspace === workspace.id
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800"
- }`}
- >
- <Folder
- className={`w-4 h-4 mr-2 ${
- currentWorkspace === workspace.id
- ? "text-indigo-600 dark:text-indigo-400"
- : "text-zinc-500 dark:text-zinc-400"
- }`}
- />
- {workspace.name}
- </button>
- ))}
+ return (
+ <>
+ <nav className="flex-1 overflow-y-auto p-3">
+ <div className="space-y-4">
+ <div>
+ <h2 className="text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-2 px-3">
+ Workspaces
+ </h2>
+ <div className="space-y-1">
+ {workspaces.map((workspace) => (
+ <button
+ type="button"
+ key={workspace.id}
+ onClick={() => setCurrentWorkspace(workspace.id)}
+ className={`w-full text-left px-3 py-2 rounded-lg flex items-center transition-colors ${
+ currentWorkspace === workspace.id
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800"
+ }`}
+ >
+ <Folder
+ className={`w-4 h-4 mr-2 ${
+ currentWorkspace === workspace.id
+ ? "text-indigo-600 dark:text-indigo-400"
+ : "text-zinc-500 dark:text-zinc-400"
+ }`}
+ />
+ {workspace.name}
+ </button>
+ ))}
- <button
- type="button"
- className="w-full text-left px-3 py-2 text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800 rounded-lg flex items-center transition-colors"
- >
- <Plus className="w-4 h-4 mr-2 text-zinc-500 dark:text-zinc-400" />
- Add Workspace
- </button>
- </div>
- </div>
+ <button
+ type="button"
+ className="w-full text-left px-3 py-2 text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800 rounded-lg flex items-center transition-colors"
+ >
+ <Plus className="w-4 h-4 mr-2 text-zinc-500 dark:text-zinc-400" />
+ Add Workspace
+ </button>
+ </div>
+ </div>
- <div>
- <h2 className="text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-2 px-3">
- Team
- </h2>
- <button
- type="button"
- className="w-full text-left px-3 py-2 text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800 rounded-lg flex items-center transition-colors"
- >
- <Users className="w-4 h-4 mr-2 text-zinc-500 dark:text-zinc-400" />
- Manage Team
- </button>
- </div>
- </div>
- </nav>
+ <div>
+ <h2 className="text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-2 px-3">
+ Team
+ </h2>
+ <button
+ type="button"
+ className="w-full text-left px-3 py-2 text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800 rounded-lg flex items-center transition-colors"
+ >
+ <Users className="w-4 h-4 mr-2 text-zinc-500 dark:text-zinc-400" />
+ Manage Team
+ </button>
+ </div>
+ </div>
+ </nav>
- <div className="p-4 border-t border-zinc-200 dark:border-zinc-800">
- <div className="flex items-center gap-3 mb-3">
- <Avatar>
- <AvatarImage src={currentUser.avatar} alt={currentUser.name} />
- <AvatarFallback>{currentUser.name.charAt(0)}</AvatarFallback>
- </Avatar>
- <div className="flex-1 min-w-0">
- <p className="text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate">
- {currentUser.name}
- </p>
- <p className="text-xs text-zinc-500 dark:text-zinc-400 truncate">
- {currentUser.email}
- </p>
- </div>
- </div>
- <div className="flex gap-1">
- <button
- type="button"
- className="flex-1 px-2 py-1.5 text-xs text-zinc-600 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800 rounded-lg flex items-center justify-center transition-colors"
- >
- <Settings className="w-3 h-3 mr-1" />
- Settings
- </button>
- <button
- type="button"
- className="flex-1 px-2 py-1.5 text-xs text-zinc-600 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800 rounded-lg flex items-center justify-center transition-colors"
- >
- <LogOut className="w-3 h-3 mr-1" />
- Sign out
- </button>
- </div>
- </div>
- </>
- );
+ <div className="p-4 border-t border-zinc-200 dark:border-zinc-800">
+ <div className="flex items-center gap-3 mb-3">
+ <Avatar>
+ <AvatarImage src={currentUser.avatar} alt={currentUser.name} />
+ <AvatarFallback>{currentUser.name.charAt(0)}</AvatarFallback>
+ </Avatar>
+ <div className="flex-1 min-w-0">
+ <p className="text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate">
+ {currentUser.name}
+ </p>
+ <p className="text-xs text-zinc-500 dark:text-zinc-400 truncate">
+ {currentUser.email}
+ </p>
+ </div>
+ </div>
+ <div className="flex gap-1">
+ <button
+ type="button"
+ className="flex-1 px-2 py-1.5 text-xs text-zinc-600 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800 rounded-lg flex items-center justify-center transition-colors"
+ >
+ <Settings className="w-3 h-3 mr-1" />
+ Settings
+ </button>
+ <button
+ type="button"
+ className="flex-1 px-2 py-1.5 text-xs text-zinc-600 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800 rounded-lg flex items-center justify-center transition-colors"
+ >
+ <LogOut className="w-3 h-3 mr-1" />
+ Sign out
+ </button>
+ </div>
+ </div>
+ </>
+ );
}
diff --git a/apps/web/src/components/common/sidebar/sidebar-header.tsx b/apps/web/src/components/common/sidebar/sidebar-header.tsx
index f916d12c3..c30ba6279 100644
--- a/apps/web/src/components/common/sidebar/sidebar-header.tsx
+++ b/apps/web/src/components/common/sidebar/sidebar-header.tsx
@@ -1,9 +1,9 @@
import { Logo } from "../logo";
export function SidebarHeader() {
- return (
- <div className="p-4 border-b border-zinc-200 dark:border-zinc-800 flex items-center justify-between">
- <Logo />
- </div>
- );
+ return (
+ <div className="p-4 border-b border-zinc-200 dark:border-zinc-800 flex items-center justify-between">
+ <Logo />
+ </div>
+ );
}
diff --git a/apps/web/src/components/ui/button.tsx b/apps/web/src/components/ui/button.tsx
index d18eb21f7..097928db0 100644
--- a/apps/web/src/components/ui/button.tsx
+++ b/apps/web/src/components/ui/button.tsx
@@ -5,52 +5,52 @@ import * as React from "react";
import { cn } from "@/lib/utils";
const buttonVariants = cva(
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
- {
- variants: {
- variant: {
- default:
- "bg-primary text-primary-foreground shadow hover:bg-primary/90",
- destructive:
- "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
- outline:
- "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
- secondary:
- "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
- ghost: "hover:bg-accent hover:text-accent-foreground",
- link: "text-primary underline-offset-4 hover:underline",
- },
- size: {
- default: "h-9 px-4 py-2",
- sm: "h-8 rounded-md px-3 text-xs",
- lg: "h-10 rounded-md px-8",
- icon: "h-9 w-9",
- },
- },
- defaultVariants: {
- variant: "default",
- size: "default",
- },
- },
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
+ {
+ variants: {
+ variant: {
+ default:
+ "bg-primary text-primary-foreground shadow hover:bg-primary/90",
+ destructive:
+ "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
+ outline:
+ "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
+ secondary:
+ "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
+ ghost: "hover:bg-accent hover:text-accent-foreground",
+ link: "text-primary underline-offset-4 hover:underline",
+ },
+ size: {
+ default: "h-9 px-4 py-2",
+ sm: "h-8 rounded-md px-3 text-xs",
+ lg: "h-10 rounded-md px-8",
+ icon: "h-9 w-9",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ size: "default",
+ },
+ }
);
export interface ButtonProps
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
- VariantProps<typeof buttonVariants> {
- asChild?: boolean;
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
+ VariantProps<typeof buttonVariants> {
+ asChild?: boolean;
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
- ({ className, variant, size, asChild = false, ...props }, ref) => {
- const Comp = asChild ? Slot : "button";
- return (
- <Comp
- className={cn(buttonVariants({ variant, size, className }))}
- ref={ref}
- {...props}
- />
- );
- },
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
+ const Comp = asChild ? Slot : "button";
+ return (
+ <Comp
+ className={cn(buttonVariants({ variant, size, className }))}
+ ref={ref}
+ {...props}
+ />
+ );
+ }
);
Button.displayName = "Button";
diff --git a/apps/web/src/components/ui/form.tsx b/apps/web/src/components/ui/form.tsx
index 215b3695f..a90ccb874 100644
--- a/apps/web/src/components/ui/form.tsx
+++ b/apps/web/src/components/ui/form.tsx
@@ -2,12 +2,12 @@ import type * as LabelPrimitive from "@radix-ui/react-label";
import { Slot } from "@radix-ui/react-slot";
import * as React from "react";
import {
- Controller,
- type ControllerProps,
- type FieldPath,
- type FieldValues,
- FormProvider,
- useFormContext,
+ Controller,
+ type ControllerProps,
+ type FieldPath,
+ type FieldValues,
+ FormProvider,
+ useFormContext,
} from "react-hook-form";
import { Label } from "@/components/ui/label";
@@ -16,162 +16,162 @@ import { cn } from "@/lib/utils";
const Form = FormProvider;
type FormFieldContextValue<
- TFieldValues extends FieldValues = FieldValues,
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
+ TFieldValues extends FieldValues = FieldValues,
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
> = {
- name: TName;
+ name: TName;
};
const FormFieldContext = React.createContext<FormFieldContextValue>(
- {} as FormFieldContextValue,
+ {} as FormFieldContextValue
);
const FormField = <
- TFieldValues extends FieldValues = FieldValues,
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
+ TFieldValues extends FieldValues = FieldValues,
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
>({
- ...props
+ ...props
}: ControllerProps<TFieldValues, TName>) => {
- return (
- <FormFieldContext.Provider value={{ name: props.name }}>
- <Controller {...props} />
- </FormFieldContext.Provider>
- );
+ return (
+ <FormFieldContext.Provider value={{ name: props.name }}>
+ <Controller {...props} />
+ </FormFieldContext.Provider>
+ );
};
const useFormField = () => {
- const fieldContext = React.useContext(FormFieldContext);
- const itemContext = React.useContext(FormItemContext);
- const { getFieldState, formState } = useFormContext();
-
- const fieldState = getFieldState(fieldContext.name, formState);
-
- if (!fieldContext) {
- throw new Error("useFormField should be used within <FormField>");
- }
-
- const { id } = itemContext;
-
- return {
- id,
- name: fieldContext.name,
- formItemId: `${id}-form-item`,
- formDescriptionId: `${id}-form-item-description`,
- formMessageId: `${id}-form-item-message`,
- ...fieldState,
- };
+ const fieldContext = React.useContext(FormFieldContext);
+ const itemContext = React.useContext(FormItemContext);
+ const { getFieldState, formState } = useFormContext();
+
+ const fieldState = getFieldState(fieldContext.name, formState);
+
+ if (!fieldContext) {
+ throw new Error("useFormField should be used within <FormField>");
+ }
+
+ const { id } = itemContext;
+
+ return {
+ id,
+ name: fieldContext.name,
+ formItemId: `${id}-form-item`,
+ formDescriptionId: `${id}-form-item-description`,
+ formMessageId: `${id}-form-item-message`,
+ ...fieldState,
+ };
};
type FormItemContextValue = {
- id: string;
+ id: string;
};
const FormItemContext = React.createContext<FormItemContextValue>(
- {} as FormItemContextValue,
+ {} as FormItemContextValue
);
const FormItem = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes<HTMLDivElement>
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => {
- const id = React.useId();
+ const id = React.useId();
- return (
- <FormItemContext.Provider value={{ id }}>
- <div ref={ref} className={cn("space-y-2", className)} {...props} />
- </FormItemContext.Provider>
- );
+ return (
+ <FormItemContext.Provider value={{ id }}>
+ <div ref={ref} className={cn("space-y-2", className)} {...props} />
+ </FormItemContext.Provider>
+ );
});
FormItem.displayName = "FormItem";
const FormLabel = React.forwardRef<
- React.ElementRef<typeof LabelPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
+ React.ElementRef<typeof LabelPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
>(({ className, ...props }, ref) => {
- const { error, formItemId } = useFormField();
-
- return (
- <Label
- ref={ref}
- className={cn(error && "text-destructive", className)}
- htmlFor={formItemId}
- {...props}
- />
- );
+ const { error, formItemId } = useFormField();
+
+ return (
+ <Label
+ ref={ref}
+ className={cn(error && "text-destructive", className)}
+ htmlFor={formItemId}
+ {...props}
+ />
+ );
});
FormLabel.displayName = "FormLabel";
const FormControl = React.forwardRef<
- React.ElementRef<typeof Slot>,
- React.ComponentPropsWithoutRef<typeof Slot>
+ React.ElementRef<typeof Slot>,
+ React.ComponentPropsWithoutRef<typeof Slot>
>(({ ...props }, ref) => {
- const { error, formItemId, formDescriptionId, formMessageId } =
- useFormField();
-
- return (
- <Slot
- ref={ref}
- id={formItemId}
- aria-describedby={
- !error
- ? `${formDescriptionId}`
- : `${formDescriptionId} ${formMessageId}`
- }
- aria-invalid={!!error}
- {...props}
- />
- );
+ const { error, formItemId, formDescriptionId, formMessageId } =
+ useFormField();
+
+ return (
+ <Slot
+ ref={ref}
+ id={formItemId}
+ aria-describedby={
+ !error
+ ? `${formDescriptionId}`
+ : `${formDescriptionId} ${formMessageId}`
+ }
+ aria-invalid={!!error}
+ {...props}
+ />
+ );
});
FormControl.displayName = "FormControl";
const FormDescription = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes<HTMLParagraphElement>
+ HTMLParagraphElement,
+ React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => {
- const { formDescriptionId } = useFormField();
-
- return (
- <p
- ref={ref}
- id={formDescriptionId}
- className={cn("text-[0.8rem] text-muted-foreground", className)}
- {...props}
- />
- );
+ const { formDescriptionId } = useFormField();
+
+ return (
+ <p
+ ref={ref}
+ id={formDescriptionId}
+ className={cn("text-[0.8rem] text-muted-foreground", className)}
+ {...props}
+ />
+ );
});
FormDescription.displayName = "FormDescription";
const FormMessage = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes<HTMLParagraphElement>
+ HTMLParagraphElement,
+ React.HTMLAttributes<HTMLParagraphElement>
>(({ className, children, ...props }, ref) => {
- const { error, formMessageId } = useFormField();
- const body = error ? String(error?.message) : children;
-
- if (!body) {
- return null;
- }
-
- return (
- <p
- ref={ref}
- id={formMessageId}
- className={cn("text-[0.8rem] font-medium text-destructive", className)}
- {...props}
- >
- {body}
- </p>
- );
+ const { error, formMessageId } = useFormField();
+ const body = error ? String(error?.message) : children;
+
+ if (!body) {
+ return null;
+ }
+
+ return (
+ <p
+ ref={ref}
+ id={formMessageId}
+ className={cn("text-[0.8rem] font-medium text-destructive", className)}
+ {...props}
+ >
+ {body}
+ </p>
+ );
});
FormMessage.displayName = "FormMessage";
export {
- useFormField,
- Form,
- FormItem,
- FormLabel,
- FormControl,
- FormDescription,
- FormMessage,
- FormField,
+ useFormField,
+ Form,
+ FormItem,
+ FormLabel,
+ FormControl,
+ FormDescription,
+ FormMessage,
+ FormField,
};
diff --git a/apps/web/src/components/ui/input.tsx b/apps/web/src/components/ui/input.tsx
index 875315a06..7bad21e11 100644
--- a/apps/web/src/components/ui/input.tsx
+++ b/apps/web/src/components/ui/input.tsx
@@ -3,19 +3,19 @@ import * as React from "react";
import { cn } from "@/lib/utils";
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
- ({ className, type, ...props }, ref) => {
- return (
- <input
- type={type}
- className={cn(
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
- className,
- )}
- ref={ref}
- {...props}
- />
- );
- },
+ ({ className, type, ...props }, ref) => {
+ return (
+ <input
+ type={type}
+ className={cn(
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
+ className
+ )}
+ ref={ref}
+ {...props}
+ />
+ );
+ }
);
Input.displayName = "Input";
diff --git a/apps/web/src/components/ui/label.tsx b/apps/web/src/components/ui/label.tsx
index 6e126e940..5bc1d3ec4 100644
--- a/apps/web/src/components/ui/label.tsx
+++ b/apps/web/src/components/ui/label.tsx
@@ -5,19 +5,19 @@ import * as React from "react";
import { cn } from "@/lib/utils";
const labelVariants = cva(
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
);
const Label = React.forwardRef<
- React.ElementRef<typeof LabelPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
- VariantProps<typeof labelVariants>
+ React.ElementRef<typeof LabelPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
+ VariantProps<typeof labelVariants>
>(({ className, ...props }, ref) => (
- <LabelPrimitive.Root
- ref={ref}
- className={cn(labelVariants(), className)}
- {...props}
- />
+ <LabelPrimitive.Root
+ ref={ref}
+ className={cn(labelVariants(), className)}
+ {...props}
+ />
));
Label.displayName = LabelPrimitive.Root.displayName;
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index e660b578e..3ab00e63f 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -7,87 +7,87 @@
@tailwind utilities;
@layer base {
- :root {
- --background: 0 0% 100%;
- --foreground: 240 10% 3.9%;
- --card: 0 0% 100%;
- --card-foreground: 240 10% 3.9%;
- --popover: 0 0% 100%;
- --popover-foreground: 240 10% 3.9%;
- --primary: 240 5.9% 10%;
- --primary-foreground: 0 0% 98%;
- --secondary: 240 4.8% 95.9%;
- --secondary-foreground: 240 5.9% 10%;
- --muted: 240 4.8% 95.9%;
- --muted-foreground: 240 3.8% 46.1%;
- --accent: 240 4.8% 95.9%;
- --accent-foreground: 240 5.9% 10%;
- --destructive: 0 84.2% 60.2%;
- --destructive-foreground: 0 0% 98%;
- --border: 240 5.9% 90%;
- --input: 240 5.9% 90%;
- --ring: 240 10% 3.9%;
- --radius: 0.5rem;
- --chart-1: 12 76% 61%;
- --chart-2: 173 58% 39%;
- --chart-3: 197 37% 24%;
- --chart-4: 43 74% 66%;
- --chart-5: 27 87% 67%;
- }
+ :root {
+ --background: 0 0% 100%;
+ --foreground: 240 10% 3.9%;
+ --card: 0 0% 100%;
+ --card-foreground: 240 10% 3.9%;
+ --popover: 0 0% 100%;
+ --popover-foreground: 240 10% 3.9%;
+ --primary: 240 5.9% 10%;
+ --primary-foreground: 0 0% 98%;
+ --secondary: 240 4.8% 95.9%;
+ --secondary-foreground: 240 5.9% 10%;
+ --muted: 240 4.8% 95.9%;
+ --muted-foreground: 240 3.8% 46.1%;
+ --accent: 240 4.8% 95.9%;
+ --accent-foreground: 240 5.9% 10%;
+ --destructive: 0 84.2% 60.2%;
+ --destructive-foreground: 0 0% 98%;
+ --border: 240 5.9% 90%;
+ --input: 240 5.9% 90%;
+ --ring: 240 10% 3.9%;
+ --radius: 0.5rem;
+ --chart-1: 12 76% 61%;
+ --chart-2: 173 58% 39%;
+ --chart-3: 197 37% 24%;
+ --chart-4: 43 74% 66%;
+ --chart-5: 27 87% 67%;
+ }
- .dark {
- --background: 240 10% 3.9%;
- --foreground: 0 0% 98%;
- --card: 240 10% 3.9%;
- --card-foreground: 0 0% 98%;
- --popover: 240 10% 3.9%;
- --popover-foreground: 0 0% 98%;
- --primary: 0 0% 98%;
- --primary-foreground: 240 5.9% 10%;
- --secondary: 240 3.7% 15.9%;
- --secondary-foreground: 0 0% 98%;
- --muted: 240 3.7% 15.9%;
- --muted-foreground: 240 5% 64.9%;
- --accent: 240 3.7% 15.9%;
- --accent-foreground: 0 0% 98%;
- --destructive: 0 62.8% 30.6%;
- --destructive-foreground: 0 0% 98%;
- --border: 240 3.7% 15.9%;
- --input: 240 3.7% 15.9%;
- --ring: 240 4.9% 83.9%;
- --chart-1: 220 70% 50%;
- --chart-2: 160 60% 45%;
- --chart-3: 30 80% 55%;
- --chart-4: 280 65% 60%;
- --chart-5: 340 75% 55%;
- }
+ .dark {
+ --background: 240 10% 3.9%;
+ --foreground: 0 0% 98%;
+ --card: 240 10% 3.9%;
+ --card-foreground: 0 0% 98%;
+ --popover: 240 10% 3.9%;
+ --popover-foreground: 0 0% 98%;
+ --primary: 0 0% 98%;
+ --primary-foreground: 240 5.9% 10%;
+ --secondary: 240 3.7% 15.9%;
+ --secondary-foreground: 0 0% 98%;
+ --muted: 240 3.7% 15.9%;
+ --muted-foreground: 240 5% 64.9%;
+ --accent: 240 3.7% 15.9%;
+ --accent-foreground: 0 0% 98%;
+ --destructive: 0 62.8% 30.6%;
+ --destructive-foreground: 0 0% 98%;
+ --border: 240 3.7% 15.9%;
+ --input: 240 3.7% 15.9%;
+ --ring: 240 4.9% 83.9%;
+ --chart-1: 220 70% 50%;
+ --chart-2: 160 60% 45%;
+ --chart-3: 30 80% 55%;
+ --chart-4: 280 65% 60%;
+ --chart-5: 340 75% 55%;
+ }
}
/* Custom scrollbar styles */
@layer utilities {
- .scrollbar-thin {
- scrollbar-width: thin;
- }
+ .scrollbar-thin {
+ scrollbar-width: thin;
+ }
- .scrollbar-thumb-zinc-700::-webkit-scrollbar-thumb {
- background-color: rgb(63 63 70);
- border-radius: 9999px;
- }
+ .scrollbar-thumb-zinc-700::-webkit-scrollbar-thumb {
+ background-color: rgb(63 63 70);
+ border-radius: 9999px;
+ }
- .scrollbar-track-zinc-900::-webkit-scrollbar-track {
- background-color: rgb(24 24 27);
- }
+ .scrollbar-track-zinc-900::-webkit-scrollbar-track {
+ background-color: rgb(24 24 27);
+ }
- .scrollbar-thin::-webkit-scrollbar {
- width: 6px;
- height: 6px;
- }
+ .scrollbar-thin::-webkit-scrollbar {
+ width: 6px;
+ height: 6px;
+ }
}
@layer base {
- * {
- @apply border-border;
- }
- body {
- @apply bg-background text-foreground;
- }
+ * {
+ @apply border-border;
+ }
+ body {
+ @apply bg-background text-foreground;
+ }
}
diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts
index ac680b303..365058ceb 100644
--- a/apps/web/src/lib/utils.ts
+++ b/apps/web/src/lib/utils.ts
@@ -2,5 +2,5 @@ import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
- return twMerge(clsx(inputs));
+ return twMerge(clsx(inputs));
}
diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx
index 2109b5cbc..411cee357 100644
--- a/apps/web/src/main.tsx
+++ b/apps/web/src/main.tsx
@@ -8,12 +8,12 @@ import "./index.css";
const rootElement = document.getElementById("root") as HTMLElement;
if (!rootElement.innerHTML) {
- const root = createRoot(rootElement);
- root.render(
- <StrictMode>
- <QueryClientProvider client={queryClient}>
- <RouterProvider router={router} />
- </QueryClientProvider>
- </StrictMode>,
- );
+ const root = createRoot(rootElement);
+ root.render(
+ <StrictMode>
+ <QueryClientProvider client={queryClient}>
+ <RouterProvider router={router} />
+ </QueryClientProvider>
+ </StrictMode>
+ );
}
diff --git a/apps/web/src/pages/__root.tsx b/apps/web/src/pages/__root.tsx
index 5541aa9c0..a813dc02c 100644
--- a/apps/web/src/pages/__root.tsx
+++ b/apps/web/src/pages/__root.tsx
@@ -4,17 +4,17 @@ import { Outlet, createRootRouteWithContext } from "@tanstack/react-router";
import { TanStackRouterDevtools } from "@tanstack/router-devtools";
export const rootRoute = createRootRouteWithContext<{
- queryClient: QueryClient;
+ queryClient: QueryClient;
}>()({
- component: RootComponent,
+ component: RootComponent,
});
function RootComponent() {
- return (
- <>
- <Outlet />
- <ReactQueryDevtools buttonPosition="top-right" />
- <TanStackRouterDevtools position="bottom-right" />
- </>
- );
+ return (
+ <>
+ <Outlet />
+ <ReactQueryDevtools buttonPosition="top-right" />
+ <TanStackRouterDevtools position="bottom-right" />
+ </>
+ );
}
diff --git a/apps/web/src/pages/auth/index.tsx b/apps/web/src/pages/auth/index.tsx
index c90e8589c..74597eb2c 100644
--- a/apps/web/src/pages/auth/index.tsx
+++ b/apps/web/src/pages/auth/index.tsx
@@ -4,33 +4,33 @@ import { Logo } from "../../components/common/logo";
import { rootRoute } from "../__root";
export const authIndexRoute = createRoute({
- getParentRoute: () => rootRoute,
- path: "/auth",
- component: AuthIndexRouteComponent,
+ getParentRoute: () => rootRoute,
+ path: "/auth",
+ component: AuthIndexRouteComponent,
});
function AuthIndexRouteComponent() {
- return (
- <div className="min-h-screen bg-gradient-to-b from-zinc-900 to-zinc-950 flex flex-col items-center justify-center p-4">
- <motion.div
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- className="w-full max-w-md"
- >
- <div className="mb-8 text-center">
- <Logo className="mx-auto mb-6" />
- <h1 className="text-3xl font-bold text-zinc-100 mb-2">
- Welcome back
- </h1>
- <p className="text-zinc-400">
- Enter your credentials to access your workspace
- </p>
- </div>
+ return (
+ <div className="min-h-screen bg-gradient-to-b from-zinc-900 to-zinc-950 flex flex-col items-center justify-center p-4">
+ <motion.div
+ initial={{ opacity: 0, y: 20 }}
+ animate={{ opacity: 1, y: 0 }}
+ className="w-full max-w-md"
+ >
+ <div className="mb-8 text-center">
+ <Logo className="mx-auto mb-6" />
+ <h1 className="text-3xl font-bold text-zinc-100 mb-2">
+ Welcome back
+ </h1>
+ <p className="text-zinc-400">
+ Enter your credentials to access your workspace
+ </p>
+ </div>
- <div className="bg-zinc-900/50 backdrop-blur-xl rounded-xl border border-zinc-800/50 p-6">
- <Outlet />
- </div>
- </motion.div>
- </div>
- );
+ <div className="bg-zinc-900/50 backdrop-blur-xl rounded-xl border border-zinc-800/50 p-6">
+ <Outlet />
+ </div>
+ </motion.div>
+ </div>
+ );
}
diff --git a/apps/web/src/pages/auth/sign-in.tsx b/apps/web/src/pages/auth/sign-in.tsx
index 478c20a26..ca13e792c 100644
--- a/apps/web/src/pages/auth/sign-in.tsx
+++ b/apps/web/src/pages/auth/sign-in.tsx
@@ -5,23 +5,23 @@ import { AuthToggle } from "../../components/auth/toggle";
import { rootRoute } from "../__root";
export const signInRoute = createRoute({
- getParentRoute: () => rootRoute,
- path: "/auth/sign-in",
- component: SignIn,
+ getParentRoute: () => rootRoute,
+ path: "/auth/sign-in",
+ component: SignIn,
});
function SignIn() {
- return (
- <AuthLayout
- title="Welcome back"
- subtitle="Enter your credentials to access your workspace"
- >
- <SignInForm />
- <AuthToggle
- message="Don't have an account?"
- linkText="Create account"
- linkTo="/auth/sign-up"
- />
- </AuthLayout>
- );
+ return (
+ <AuthLayout
+ title="Welcome back"
+ subtitle="Enter your credentials to access your workspace"
+ >
+ <SignInForm />
+ <AuthToggle
+ message="Don't have an account?"
+ linkText="Create account"
+ linkTo="/auth/sign-up"
+ />
+ </AuthLayout>
+ );
}
diff --git a/apps/web/src/pages/auth/sign-up.tsx b/apps/web/src/pages/auth/sign-up.tsx
index 2c5f95e94..a60f9e041 100644
--- a/apps/web/src/pages/auth/sign-up.tsx
+++ b/apps/web/src/pages/auth/sign-up.tsx
@@ -5,23 +5,23 @@ import { AuthToggle } from "../../components/auth/toggle";
import { rootRoute } from "../__root";
export const signUpRoute = createRoute({
- getParentRoute: () => rootRoute,
- path: "/auth/sign-up",
- component: SignUp,
+ getParentRoute: () => rootRoute,
+ path: "/auth/sign-up",
+ component: SignUp,
});
function SignUp() {
- return (
- <AuthLayout
- title="Create account"
- subtitle="Get started with your free workspace"
- >
- <SignInForm />
- <AuthToggle
- message="Already have an account?"
- linkText="Sign in"
- linkTo="/auth/sign-in"
- />
- </AuthLayout>
- );
+ return (
+ <AuthLayout
+ title="Create account"
+ subtitle="Get started with your free workspace"
+ >
+ <SignInForm />
+ <AuthToggle
+ message="Already have an account?"
+ linkText="Sign in"
+ linkTo="/auth/sign-in"
+ />
+ </AuthLayout>
+ );
}
diff --git a/apps/web/src/pages/index.tsx b/apps/web/src/pages/index.tsx
index 91d01e512..9cacd9759 100644
--- a/apps/web/src/pages/index.tsx
+++ b/apps/web/src/pages/index.tsx
@@ -5,21 +5,21 @@ import { Sidebar } from "../components/common/sidebar";
import { rootRoute } from "./__root";
export const indexRoute = createRoute({
- getParentRoute: () => rootRoute,
- path: "/",
- component: IndexRouteComponent,
+ getParentRoute: () => rootRoute,
+ path: "/",
+ component: IndexRouteComponent,
});
function IndexRouteComponent() {
- const { data } = useQuery({
- queryKey: ["me"],
- queryFn: () => api.me.get(),
- });
+ const { data } = useQuery({
+ queryKey: ["me"],
+ queryFn: () => api.me.get(),
+ });
- return (
- <div className="flex h-screen flex-col md:flex-row bg-zinc-50 dark:bg-zinc-950">
- <Sidebar />
- <main className="flex-1 overflow-hidden p-6">{JSON.stringify(data)}</main>
- </div>
- );
+ return (
+ <div className="flex h-screen flex-col md:flex-row bg-zinc-50 dark:bg-zinc-950">
+ <Sidebar />
+ <main className="flex-1 overflow-hidden p-6">{JSON.stringify(data)}</main>
+ </div>
+ );
}
diff --git a/apps/web/src/router/index.ts b/apps/web/src/router/index.ts
index 04ac3349a..a0081070a 100644
--- a/apps/web/src/router/index.ts
+++ b/apps/web/src/router/index.ts
@@ -7,24 +7,24 @@ import { signUpRoute } from "../pages/auth/sign-up";
import queryClient from "../query-client";
const routeTree = rootRoute.addChildren([
- indexRoute.addChildren([
- authIndexRoute.addChildren([signInRoute, signUpRoute]),
- ]),
+ indexRoute.addChildren([
+ authIndexRoute.addChildren([signInRoute, signUpRoute]),
+ ]),
]);
const router = createRouter({
- routeTree,
- defaultPreload: "intent",
- defaultPreloadStaleTime: 0,
- context: {
- queryClient,
- },
+ routeTree,
+ defaultPreload: "intent",
+ defaultPreloadStaleTime: 0,
+ context: {
+ queryClient,
+ },
});
declare module "@tanstack/react-router" {
- interface Register {
- router: typeof router;
- }
+ interface Register {
+ router: typeof router;
+ }
}
export default router;
diff --git a/apps/web/tsconfig.app.json b/apps/web/tsconfig.app.json
index 940a9e671..91fcf1f98 100644
--- a/apps/web/tsconfig.app.json
+++ b/apps/web/tsconfig.app.json
@@ -20,11 +20,11 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
- "noUncheckedSideEffectImports": true
+ "noUncheckedSideEffectImports": true,
+ "paths": {
+ "@/*": ["./src/*"]
+ }
},
"include": ["src"],
- "baseUrl": ".",
- "paths": {
- "@/*": ["./src/*"]
- }
+ "baseUrl": "."
}
diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json
index 9bc6a8b36..fec8c8e5c 100644
--- a/apps/web/tsconfig.json
+++ b/apps/web/tsconfig.json
@@ -1,13 +1,13 @@
{
- "files": [],
- "references": [
- { "path": "./tsconfig.app.json" },
- { "path": "./tsconfig.node.json" }
- ],
- "compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "@/*": ["./src/*"]
- }
- }
+ "files": [],
+ "references": [
+ { "path": "./tsconfig.app.json" },
+ { "path": "./tsconfig.node.json" }
+ ],
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ }
+ }
}
diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts
index 9f45bdde2..d3bd623b2 100644
--- a/apps/web/vite.config.ts
+++ b/apps/web/vite.config.ts
@@ -5,13 +5,13 @@ import { defineConfig } from "vite";
// https://vite.dev/config/
export default defineConfig({
- plugins: [TanStackRouterVite(), react()],
- server: {
- host: true,
- },
- resolve: {
- alias: {
- "@": path.resolve(__dirname, "./src"),
- },
- },
+ plugins: [TanStackRouterVite(), react()],
+ server: {
+ host: true,
+ },
+ resolve: {
+ alias: {
+ "@": path.resolve(__dirname, "./src"),
+ },
+ },
});
diff --git a/packages/libs/src/eden.ts b/packages/libs/src/eden.ts
index 500399044..e6b8ff328 100644
--- a/packages/libs/src/eden.ts
+++ b/packages/libs/src/eden.ts
@@ -2,7 +2,7 @@ import { treaty } from "@elysiajs/eden";
import type { App } from "@kaneo/api";
export const api = treaty<App>("http://localhost:1337", {
- fetch: {
- credentials: "include",
- },
+ fetch: {
+ credentials: "include",
+ },
});
diff --git a/packages/typescript-config/base.json b/packages/typescript-config/base.json
index 0756a8cde..5117f2a3d 100644
--- a/packages/typescript-config/base.json
+++ b/packages/typescript-config/base.json
@@ -1,19 +1,19 @@
{
- "$schema": "https://json.schemastore.org/tsconfig",
- "compilerOptions": {
- "declaration": true,
- "declarationMap": true,
- "esModuleInterop": true,
- "incremental": false,
- "isolatedModules": true,
- "lib": ["es2022", "DOM", "DOM.Iterable"],
- "module": "NodeNext",
- "moduleDetection": "force",
- "moduleResolution": "NodeNext",
- "noUncheckedIndexedAccess": true,
- "resolveJsonModule": true,
- "skipLibCheck": true,
- "strict": true,
- "target": "ES2022"
- }
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "compilerOptions": {
+ "declaration": true,
+ "declarationMap": true,
+ "esModuleInterop": true,
+ "incremental": false,
+ "isolatedModules": true,
+ "lib": ["es2022", "DOM", "DOM.Iterable"],
+ "module": "NodeNext",
+ "moduleDetection": "force",
+ "moduleResolution": "NodeNext",
+ "noUncheckedIndexedAccess": true,
+ "resolveJsonModule": true,
+ "skipLibCheck": true,
+ "strict": true,
+ "target": "ES2022"
+ }
}
diff --git a/packages/typescript-config/package.json b/packages/typescript-config/package.json
index aeb91c5f7..653b21881 100644
--- a/packages/typescript-config/package.json
+++ b/packages/typescript-config/package.json
@@ -1,9 +1,9 @@
{
- "name": "@kaneo/typescript-config",
- "version": "0.0.0",
- "private": true,
- "license": "MIT",
- "publishConfig": {
- "access": "public"
- }
+ "name": "@kaneo/typescript-config",
+ "version": "0.0.0",
+ "private": true,
+ "license": "MIT",
+ "publishConfig": {
+ "access": "public"
+ }
}
diff --git a/packages/typescript-config/react-library.json b/packages/typescript-config/react-library.json
index 44957d69b..c3a1b26fb 100644
--- a/packages/typescript-config/react-library.json
+++ b/packages/typescript-config/react-library.json
@@ -1,7 +1,7 @@
{
- "$schema": "https://json.schemastore.org/tsconfig",
- "extends": "./base.json",
- "compilerOptions": {
- "jsx": "react-jsx"
- }
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "extends": "./base.json",
+ "compilerOptions": {
+ "jsx": "react-jsx"
+ }
}