Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitrisnl committed Feb 21, 2024
1 parent e15e375 commit 972fac7
Show file tree
Hide file tree
Showing 19 changed files with 1,855 additions and 1,341 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ tmp

# temp
docker
.gitpod.yml
.gitpod.yml
vite.config.ts.timestamp-*

3 changes: 2 additions & 1 deletion app/core/domain/user.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {Data, Effect} from 'effect';
import {compose} from 'effect/Function';
import type {users} from 'zapatos/schema';

import {db} from '../db/schema.server.ts';
import {db} from '~/core/db/schema.server.ts';

import {emailSchema} from './email.server.ts';
import {uuidSchema} from './uuid.server.ts';

Expand Down
6 changes: 1 addition & 5 deletions app/core/lib/helpers.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {ActionFunctionArgs, LoaderFunctionArgs} from '@remix-run/node';
import {Context} from 'effect';
import type {LoaderFunctionArgs} from '@remix-run/node';
import * as Effect from 'effect/Effect';

import {pool} from '~/core/db/pool.server';
Expand Down Expand Up @@ -41,6 +40,3 @@ export function authenticateUser(request: Request) {
})
);
}

export const ActionArgs = Context.Tag<ActionFunctionArgs>('ActionArgs');
export const LoaderArgs = Context.Tag<LoaderFunctionArgs>('LoaderArgs');
4 changes: 2 additions & 2 deletions app/core/lib/respond.server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {typedjson} from 'remix-typedjson';
import {redirect, typedjson} from 'remix-typedjson';

export const respond = {
serverError: () => {
Expand All @@ -14,7 +14,7 @@ export const respond = {
return typedjson({ok: false as const, errors}, {status: 401});
},
redirect: (to: string, init: RequestInit = {}) => {
return new Response(null, {status: 302, ...init, headers: {Location: to}});
return redirect(to, init);
},
ok: (data: unknown) => {
return typedjson({ok: true as const, data});
Expand Down
2 changes: 1 addition & 1 deletion app/core/lib/validation-helper.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as Effect from 'effect/Effect';
import {ValidationError} from '~/core/lib/errors.server';

export const schemaResolver =
<I, A>(validationSchema: Schema.Schema<never, I, A>) =>
<I, A>(validationSchema: Schema.Schema<A, I>) =>
(data: unknown) => {
return pipe(
Schema.decodeUnknown(validationSchema)(data, {
Expand Down
4 changes: 2 additions & 2 deletions app/core/lib/with-action.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import {
matchHttpResponseError,
} from '~/core/lib/responses.server';

export const ActionArgs = Context.Tag<ActionFunctionArgs>('ActionArgs');
export const ActionArgs = Context.GenericTag<ActionFunctionArgs>('ActionArgs');

// Don't throw the Error requests, handle them in the normal UI. No ErrorBoundary
export const withAction =
<T>(
self: Effect.Effect<ActionFunctionArgs, HttpResponseError, HttpResponse<T>>
self: Effect.Effect<HttpResponse<T>, HttpResponseError, ActionFunctionArgs>
) =>
(args: ActionFunctionArgs) => {
const runnable = pipe(
Expand Down
4 changes: 2 additions & 2 deletions app/core/lib/with-loader.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import {
matchHttpResponseError,
} from '~/core/lib/responses.server';

export const LoaderArgs = Context.Tag<LoaderFunctionArgs>('LoaderArgs');
export const LoaderArgs = Context.GenericTag<LoaderFunctionArgs>('LoaderArgs');

// Respond with OK, Redirect
// Throw all else, and land on a ErrorBoundary
export const withLoader =
<T>(
self: Effect.Effect<LoaderFunctionArgs, HttpResponseError, HttpResponse<T>>
self: Effect.Effect<HttpResponse<T>, HttpResponseError, LoaderFunctionArgs>
) =>
(args: LoaderFunctionArgs) => {
const runnable = pipe(self, Effect.provideService(LoaderArgs, args));
Expand Down
12 changes: 12 additions & 0 deletions app/routes/logout/_loader.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as Effect from 'effect/Effect';

import {logout} from '~/core/lib/session.server';
import {LoaderArgs, withLoader} from '~/core/lib/with-loader.server';

export const loader = withLoader(
Effect.gen(function* (_) {
const {request} = yield* _(LoaderArgs);

return yield* _(logout(request));
})
);
1 change: 1 addition & 0 deletions app/routes/logout/_route.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export {action} from './_action.server.ts';
export {loader} from './_loader.server.ts';
8 changes: 1 addition & 7 deletions app/routes/onboarding.create-new-team/_route.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import {GenericLayout} from '~/components/guest-layout.tsx';

import {TeamInfo} from './team-info.tsx';

export {action} from './_action.server.ts';
export {loader} from './_loader.server.ts';

export default function CreateNewTeam() {
return (
<GenericLayout>
<TeamInfo />
</GenericLayout>
);
return <TeamInfo />;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import {GenericLayout} from '~/components/guest-layout.tsx';

import {OnboardingSwitch} from './onboarding-switch.tsx';

export {loader} from './_loader.server.ts';

export default function OnboardingPage() {
return (
<GenericLayout>
<OnboardingSwitch />
</GenericLayout>
);
return <OnboardingSwitch />;
}
8 changes: 1 addition & 7 deletions app/routes/onboarding.join-team/_route.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import {GenericLayout} from '~/components/guest-layout.tsx';

import {InvitationsList} from './invitations-list.tsx';

export {action} from './_action.server.ts';
export {loader} from './_loader.server.ts';

export default function JoinTeamPage() {
return (
<GenericLayout>
<InvitationsList />
</GenericLayout>
);
return <InvitationsList />;
}
11 changes: 11 additions & 0 deletions app/routes/onboarding/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {Outlet} from '@remix-run/react';

import {GenericLayout} from '~/components/guest-layout.tsx';

export default function OnboardingLayout() {
return (
<GenericLayout>
<Outlet />
</GenericLayout>
);
}
68 changes: 35 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"type": "module",
"scripts": {
"build:app": "remix vite:build",
"build:app:profile": "remix vite:build --profile",
"build:storybook": "storybook build",
"db-schema:generate": "node --loader ts-node/esm -r dotenv-flow/config ./app/core/db/generate-schema.ts",
"db:down": "docker-compose -f docker-compose.yml down",
"db:up": "docker compose -f docker-compose.yml up",
"dev": "remix vite:dev",
"dev:profile": "remix vite:dev --profile",
"format": "prettier --write .",
"preinstall": "npx only-allow pnpm",
"lint:fix": "eslint --ext .ts,.tsx . --fix",
Expand All @@ -27,7 +29,7 @@
"typecheck": "tsc"
},
"dependencies": {
"@effect/schema": "0.61.4",
"@effect/schema": "0.63.0",
"@heroicons/react": "^2.1.1",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-checkbox": "^1.0.4",
Expand All @@ -40,21 +42,21 @@
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tabs": "^1.0.4",
"@remix-run/css-bundle": "^2.5.1",
"@remix-run/node": "^2.5.1",
"@remix-run/react": "^2.5.1",
"@remix-run/serve": "^2.5.1",
"@remix-run/css-bundle": "^2.7.1",
"@remix-run/node": "^2.7.1",
"@remix-run/react": "^2.7.1",
"@remix-run/serve": "^2.7.1",
"@sindresorhus/slugify": "^2.2.1",
"@tanstack/react-table": "^8.11.6",
"@tanstack/react-table": "^8.12.0",
"bcryptjs": "^2.4.3",
"bullmq": "^5.1.5",
"bullmq": "^5.3.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"dotenv-flow": "^4.1.0",
"effect": "2.2.3",
"effect": "2.4.0",
"ioredis": "^5.3.2",
"isbot": "^4.4.0",
"nodemailer": "^6.9.8",
"isbot": "^5.1.0",
"nodemailer": "^6.9.9",
"nprogress": "^0.2.0",
"pg": "^8.11.3",
"react": "^18.2.0",
Expand All @@ -68,57 +70,57 @@
"zapatos": "^6.3.0"
},
"devDependencies": {
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"@faker-js/faker": "^8.4.0",
"@remix-run/dev": "^2.5.1",
"@storybook/addon-essentials": "^7.6.9",
"@storybook/addon-interactions": "^7.6.9",
"@storybook/addon-links": "^7.6.9",
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@faker-js/faker": "^8.4.1",
"@remix-run/dev": "^2.7.1",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",
"@storybook/addon-links": "^7.6.17",
"@storybook/addon-onboarding": "^1.0.11",
"@storybook/blocks": "^7.6.9",
"@storybook/react": "^7.6.9",
"@storybook/react-vite": "^7.6.9",
"@storybook/blocks": "^7.6.17",
"@storybook/react": "^7.6.17",
"@storybook/react-vite": "^7.6.17",
"@storybook/testing-library": "^0.2.2",
"@total-typescript/ts-reset": "^0.5.1",
"@types/bcryptjs": "^2.4.6",
"@types/node": "^20.11.10",
"@types/node": "^20.11.19",
"@types/nodemailer": "^6.4.14",
"@types/nprogress": "^0.2.3",
"@types/pg": "^8.11.0",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@types/react": "^18.2.57",
"@types/react-dom": "^18.2.19",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "6.20.0",
"autoprefixer": "^10.4.17",
"dbmate": "^2.11.0",
"dbmate": "^2.12.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-storybook": "^0.6.15",
"prettier": "^3.2.4",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-storybook": "^0.8.0",
"prettier": "^3.2.5",
"prettier-eslint": "^16.3.0",
"prettier-plugin-packagejson": "^2.4.9",
"prettier-plugin-packagejson": "^2.4.11",
"prettier-plugin-tailwindcss": "^0.5.11",
"rimraf": "^5.0.5",
"rollup-plugin-visualizer": "^5.12.0",
"storybook": "^7.6.9",
"storybook": "^7.6.17",
"tailwindcss": "^3.4.1",
"tailwindcss-animate": "^1.0.7",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vite": "^5.1.4",
"vite-tsconfig-paths": "^4.3.1",
"vitest": "^1.2.2"
"vitest": "^1.3.1"
},
"optionalDependencies": {
"husky": "^8.0.3"
"husky": "^9.0.11"
},
"engines": {
"node": ">=18"
Expand Down
Loading

0 comments on commit 972fac7

Please sign in to comment.