Skip to content

Commit

Permalink
Merge pull request #65 from 8iq/v_0.0.2_alpha
Browse files Browse the repository at this point in the history
V 0.0.2 alpha
  • Loading branch information
pahaz authored Jun 12, 2024
2 parents fa3add9 + 5d9bf1f commit 385bc7a
Show file tree
Hide file tree
Showing 86 changed files with 15,359 additions and 105 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,jsx,ts,tsx}]
charset = utf-8
indent_style = space
indent_size = 2
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#DATABASE_URL=mongodb://mongo:mongo@127.0.0.1/main?authSource=admin
#DATABASE_URL=postgresql://postgres:postgres@127.0.0.1/main
#DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/main
#REDIS_URL=redis://127.0.0.1:6379/1
NODE_ENV=development
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
.pnp.*
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all",
"semi": false
}
Binary file modified .yarn/install-state.gz
Binary file not shown.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1.7-labs
FROM buildpack-deps:bookworm AS base
# https://hub.docker.com/_/node
# https://github.com/nodejs/docker-node/blob/18ed56ea9ba03c16f48372927f5eb2553033e8de/14/buster/Dockerfile
Expand Down Expand Up @@ -36,10 +37,9 @@ RUN echo "# Build time .env config!" >> /home/app/.env && \
echo "DATABASE_URL=undefined" >> /home/app/.env && \
echo "NODE_ENV=production" >> /home/app/.env

COPY package*.json ./
COPY ./yarn.lock ./yarn.lock
COPY ./.yarn ./.yarn
COPY ./.yarnrc.yml ./.yarnrc.yml
COPY package*.json yarn.lock .yarn .yarnrc.yml ./
COPY --parents packages/*/package.json ./
COPY --parents apps/*/package.json ./

# Cache packages!
RUN set -ex \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Hackathon workflow](https://image.shutterstock.com/image-vector/banner-hackathon-design-sprintlike-event-260nw-1418226719.jpg)](https://drive.google.com/drive/folders/1Srw2T91_rRLTWgJc-Zh693hhbD2JS6Yh)

What's inside? React + Next.js + Ant + Turbo + react-i18next + Refine
What's inside? React + Next.js + Ant + Turbo + react-i18next + Refine

# Rapid Development Node.js Hackathon template

Expand Down
9 changes: 9 additions & 0 deletions apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ["@repo/eslint-config/next.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
};
12 changes: 12 additions & 0 deletions apps/web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# `web`

Simple Front-End WEB app example

# What do you need to change?

1. You need to stats from `providers.tsx` logic and
create your own `AuthProvider` and `DataProvider` and `resources`.

DOCS: https://refine.dev/docs/data/data-provider/

2.
18 changes: 18 additions & 0 deletions apps/web/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use server'

import { Show } from '@repo/ui/refine/antd'

import { Layout } from 'web/components/Layout'
import { getTranslate } from 'web/providers/i18n/server'

export default async function DashboardPage(): Promise<React.JSX.Element> {
const translate = await getTranslate()
const titleMessage = translate('dashboard.title', 'Dashboard')
return (
<Layout>
<Show headerButtons={[]} title={titleMessage}>
<h1>{titleMessage}</h1>
</Show>
</Layout>
)
}
29 changes: 29 additions & 0 deletions apps/web/app/forgot-password/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use client'

import { AuthPage } from '@repo/ui/refine/antd'
import { useParsed } from '@repo/ui/refine/core'
import React from 'react'

import { BrandTitle } from 'web/components/BrandTitle'

interface QueryProps {
email?: string
}

export default function ForgotPasswordPage(): React.JSX.Element {
const { params } = useParsed<QueryProps>()

const emailFromSearchParams = params?.email

const initialValues = emailFromSearchParams
? { email: emailFromSearchParams }
: undefined

return (
<AuthPage
type="forgotPassword"
formProps={{ initialValues }}
title={<BrandTitle collapsed={false} />}
/>
)
}
38 changes: 38 additions & 0 deletions apps/web/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
:root {
--max-width: 1100px;
--border-radius: 12px;
--font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono",
"Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro",
"Fira Mono", "Droid Sans Mono", "Courier New", monospace;

--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;

--callout-rgb: 20, 20, 20;
--callout-border-rgb: 108, 108, 108;
--card-rgb: 100, 100, 100;
--card-border-rgb: 200, 200, 200;

--glow-conic: conic-gradient(
from 180deg at 50% 50%,
#2a8af6 0deg,
#a853ba 180deg,
#e92a67 360deg
);
}

html,
body {
max-width: 100vw;
overflow-x: hidden;
}

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
) rgb(var(--background-start-rgb));
}
25 changes: 25 additions & 0 deletions apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { dir, getLocale } from '@repo/i18n/server'
import { Inter } from 'next/font/google'

import './globals.css'
import React from 'react'
import { Providers } from './providers'

const inter = Inter({ subsets: ['latin'] })

export default async function RootLayout({
children,
}: {
children: React.ReactNode
}): Promise<React.JSX.Element> {
const locale = await getLocale()
const theme = 'dark'

return (
<html lang={locale} dir={dir(locale)}>
<body className={inter.className}>
<Providers locale={locale} theme={theme}>{children}</Providers>
</body>
</html>
)
}
71 changes: 71 additions & 0 deletions apps/web/app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
'use client'

import { GithubOutlined, GoogleOutlined } from '@repo/ui/icons'
import { AuthPage } from '@repo/ui/refine/antd'
import { useLogin, useParsed, useTranslate } from '@repo/ui/refine/core'
import React, { useEffect } from 'react'

import { BrandTitle } from 'web/components/BrandTitle'

interface QueryProps {
email?: string
accessToken?: string
refreshToken?: string
}

export default function LoginPage(): React.JSX.Element {
const { params } = useParsed<QueryProps>()
const { mutate } = useLogin()
const translate = useTranslate()

const emailFromSearchParams = params?.email
const accessToken = params?.accessToken
const refreshToken = params?.refreshToken

const initialValues = emailFromSearchParams
? { email: emailFromSearchParams }
: undefined

useEffect(() => {
if (accessToken && refreshToken) {
mutate({
accessToken,
refreshToken,
})
}
}, [accessToken, refreshToken])

return (
<AuthPage
type="login"
formProps={{ initialValues }}
title={<BrandTitle collapsed={false} />}
providers={[
{
name: 'google',
label: translate('pages.login.google', 'Sign in with Google'),
icon: (
<GoogleOutlined
style={{
fontSize: 24,
lineHeight: 0,
}}
/>
),
},
{
name: 'github',
label: translate('pages.login.github', 'Sign in with GitHub'),
icon: (
<GithubOutlined
style={{
fontSize: 24,
lineHeight: 0,
}}
/>
),
},
]}
/>
)
}
Loading

0 comments on commit 385bc7a

Please sign in to comment.