This repository has been archived by the owner on Jan 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce PNPM, Workspaces and Remix app (#8)
- Loading branch information
1 parent
dbff684
commit 00e3748
Showing
274 changed files
with
16,625 additions
and
37,965 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,4 @@ tmp | |
|
||
|
||
# temp | ||
web | ||
docker | ||
docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
build | ||
node_modules | ||
tmp | ||
dist | ||
.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"root": true, | ||
"parserOptions": { | ||
"tsconfigRootDir": "." | ||
}, | ||
"extends": ["custom-adonis"], | ||
"settings": { | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [".ts", ".tsx"], | ||
"moduleDirectory": ["src", "node_modules"] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
build | ||
dist | ||
coverage | ||
.env | ||
tmp |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
apps/api/app/modules/user/useCases/verifyPasswordReset/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {verifyPasswordReset} from './verifyPasswordReset'; |
19 changes: 19 additions & 0 deletions
19
apps/api/app/modules/user/useCases/verifyPasswordReset/validation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {schema, validator} from '@ioc:Adonis/Core/Validator'; | ||
|
||
import {uuidTokenSchema} from '../../constants/validations'; | ||
|
||
const validatorSchema = schema.create({ | ||
token: uuidTokenSchema, | ||
}); | ||
|
||
export async function validate(props: Record<string, unknown>) { | ||
const {token} = await validator.validate({ | ||
schema: validatorSchema, | ||
data: props, | ||
messages: { | ||
'token.required': 'Please enter a token', | ||
'token.uuid': 'Please enter a valid token', | ||
}, | ||
}); | ||
return {token}; | ||
} |
33 changes: 33 additions & 0 deletions
33
apps/api/app/modules/user/useCases/verifyPasswordReset/verifyPasswordReset.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as E from 'fp-ts/Either'; | ||
|
||
import User from '../../models/User'; | ||
import {PasswordResetService} from '../../services/passwordResetService'; | ||
import {validate} from './validation'; | ||
|
||
type Response = E.Either<'InvalidTokenError', User>; | ||
|
||
interface Props { | ||
token: string; | ||
} | ||
|
||
interface Dependencies { | ||
passwordResetService: PasswordResetService; | ||
} | ||
|
||
export function verifyPasswordReset({passwordResetService}: Dependencies) { | ||
async function execute(props: Props): Promise<Response> { | ||
const {token} = props; | ||
const user = await passwordResetService.getUserByToken(token); | ||
|
||
if (!user) { | ||
return E.left('InvalidTokenError'); | ||
} | ||
|
||
return E.right(user); | ||
} | ||
|
||
return { | ||
execute, | ||
validate, | ||
}; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"root": false, | ||
"extends": "adonis-preset-ts/tsconfig.json", | ||
"include": ["**/*"], | ||
"exclude": ["node_modules", "build"], | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "build", | ||
"rootDir": "./", | ||
"sourceMap": true, | ||
"paths": { | ||
"@/*": ["./*"] | ||
}, | ||
"moduleResolution": "node", | ||
"types": [ | ||
"@adonisjs/core", | ||
"@adonisjs/repl", | ||
"@japa/preset-adonis/build/adonis-typings", | ||
"@adonisjs/lucid", | ||
"@adonisjs/lucid-slugify", | ||
"@adonisjs/auth", | ||
"@adonisjs/mail", | ||
"@adonisjs/view", | ||
"@adonisjs/redis", | ||
"@adonisjs/bouncer" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"root": true, | ||
"parserOptions": { | ||
"tsconfigRootDir": "." | ||
}, | ||
"extends": ["custom-remix"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
|
||
/.cache | ||
/build | ||
/public/build | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {Alert, AlertDescription, AlertTitle} from 'ui-core'; | ||
|
||
export function ErrorFeedback({ | ||
errors = {}, | ||
}: { | ||
errors?: Record<string, string>; | ||
}) { | ||
const description = | ||
Object.keys(errors).length > 0 ? ( | ||
Object.keys(errors).map((key) => { | ||
const message = errors[key]; | ||
return ( | ||
<li key={key}> | ||
<AlertDescription>{message}</AlertDescription> | ||
</li> | ||
); | ||
}) | ||
) : ( | ||
<AlertDescription>Let's try again, shall we?</AlertDescription> | ||
); | ||
|
||
return ( | ||
<Alert variant="destructive"> | ||
<AlertTitle>Something went wrong</AlertTitle> | ||
<ul className="list-disc pl-4">{description}</ul> | ||
</Alert> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import {Link} from '@remix-run/react'; | ||
import React from 'react'; | ||
import {cn} from 'ui-core'; | ||
|
||
import TeamSwitcher from '@/components/team-switcher'; | ||
import {UserNav} from '@/components/user-nav'; | ||
import {useUser} from '@/lib/user'; | ||
|
||
function MainNav({className, ...props}: React.HTMLAttributes<HTMLElement>) { | ||
return ( | ||
<nav | ||
className={cn('flex items-center space-x-4 lg:space-x-6', className)} | ||
{...props} | ||
> | ||
<Link | ||
to="/" | ||
className="hover:text-primary text-sm font-medium transition-colors" | ||
> | ||
Overview | ||
</Link> | ||
<Link | ||
to="/teams" | ||
className="text-muted-foreground hover:text-primary text-sm font-medium transition-colors" | ||
> | ||
Teams | ||
</Link> | ||
<Link | ||
to="/settings" | ||
className="text-muted-foreground hover:text-primary text-sm font-medium transition-colors" | ||
> | ||
Settings | ||
</Link> | ||
</nav> | ||
); | ||
} | ||
|
||
export function BaseLayout({ | ||
children, | ||
title, | ||
titleSlot, | ||
}: { | ||
children: React.ReactNode; | ||
title: string; | ||
titleSlot?: React.ReactNode; | ||
}) { | ||
const user = useUser(); | ||
|
||
return ( | ||
<div className="flex min-h-screen flex-col"> | ||
<div className="border-b shadow-2xl"> | ||
<div className="flex h-16 items-center border-b px-4"> | ||
<h1 className="text-2xl font-bold tracking-tight">White Label</h1> | ||
<MainNav className="mx-6" /> | ||
<div className="ml-auto flex items-center space-x-4"> | ||
<UserNav user={user} /> | ||
</div> | ||
</div> | ||
<div className="50 flex h-16 items-center px-8"> | ||
<div className="flex items-center justify-between space-y-2"> | ||
<h2 className="text-3xl font-bold tracking-tight">{title}</h2> | ||
{titleSlot} | ||
</div> | ||
</div> | ||
</div> | ||
<div className="flex-1 space-y-4 bg-gray-50 p-8 pt-6">{children}</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {BoxIcon} from 'lucide-react'; | ||
import React from 'react'; | ||
|
||
export function GuestLayout({children}: {children: React.ReactNode}) { | ||
return ( | ||
<div className="flex min-h-screen flex-col items-center gap-10 bg-slate-100 pt-16"> | ||
<div className="flex flex-col items-center space-y-4 leading-none"> | ||
<div className="h-12 w-12 rounded-full bg-blue-100 p-2"> | ||
<BoxIcon className="h-full w-full text-blue-700" /> | ||
</div> | ||
<h1 className="text-4xl font-bold">White Label</h1> | ||
</div> | ||
<div>{children}</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.