Skip to content

Commit

Permalink
Merge pull request #66 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 15, 2024
2 parents 385bc7a + 26f7a89 commit 3ce1ece
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 19 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![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)

![form example](./docs/_img/01-form-example.png)

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

# Rapid Development Node.js Hackathon template
Expand Down
11 changes: 9 additions & 2 deletions apps/web/app/samples/[id]/clone/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
'use server'

import { AntdInferencer } from '@repo/ui/refine/antd'
import dynamic from 'next/dynamic'
import React from 'react'

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

export default async function ClonePage(): Promise<React.JSX.Element> {
const AntdInferencer = dynamic(
() => import('@repo/ui/refine/antd').then((i) => i.AntdInferencer),
{
ssr: false,
},
)

export default async function ClonePage() {
return (
<Layout>
<AntdInferencer />
Expand Down
11 changes: 9 additions & 2 deletions apps/web/app/samples/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
'use server'

import { AntdInferencer } from '@repo/ui/refine/antd'
import dynamic from 'next/dynamic'
import React from 'react'

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

export default async function EditPage(): Promise<React.JSX.Element> {
const AntdInferencer = dynamic(
() => import('@repo/ui/refine/antd').then((i) => i.AntdInferencer),
{
ssr: false,
},
)

export default async function EditPage() {
return (
<Layout>
<AntdInferencer />
Expand Down
11 changes: 9 additions & 2 deletions apps/web/app/samples/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
'use server'

import { AntdInferencer } from '@repo/ui/refine/antd'
import dynamic from 'next/dynamic'
import React from 'react'

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

export default async function ShowPage(): Promise<React.JSX.Element> {
const AntdInferencer = dynamic(
() => import('@repo/ui/refine/antd').then((i) => i.AntdInferencer),
{
ssr: false,
},
)

export default async function ShowPage() {
return (
<Layout>
<AntdInferencer />
Expand Down
11 changes: 9 additions & 2 deletions apps/web/app/samples/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
'use server'

import { AntdInferencer } from '@repo/ui/refine/antd'
import dynamic from 'next/dynamic'
import React from 'react'

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

export default async function CreatePage(): Promise<React.JSX.Element> {
const AntdInferencer = dynamic(
() => import('@repo/ui/refine/antd').then((i) => i.AntdInferencer),
{
ssr: false,
},
)

export default async function CreatePage() {
return (
<Layout>
<AntdInferencer />
Expand Down
11 changes: 9 additions & 2 deletions apps/web/app/samples/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
'use server'

import { AntdInferencer } from '@repo/ui/refine/antd'
import dynamic from 'next/dynamic'
import React from 'react'

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

export default async function ListPage(): Promise<React.JSX.Element> {
const AntdInferencer = dynamic(
() => import('@repo/ui/refine/antd').then((i) => i.AntdInferencer),
{
ssr: false,
},
)

export default async function ListPage() {
return (
<Layout>
<AntdInferencer />
Expand Down
9 changes: 4 additions & 5 deletions apps/web/components/Layout/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
'use client'

import {
useIsAuthenticated,
useLink,
} from '@repo/ui/refine/core'
import { useIsAuthenticated, useLink, useTranslate } from '@repo/ui/refine/core'
import React from 'react'

import { Layout, Space, theme } from '@repo/ui/general'
Expand All @@ -17,6 +14,8 @@ export const Header: React.FC = () => {
const Link = useLink()
const { data: auth } = useIsAuthenticated()
const isAuthenticated = auth?.authenticated
const translate = useTranslate()
const loginMessage = translate('buttons.login', 'Login')

const headerStyles: React.CSSProperties = {
backgroundColor: token.colorBgElevated,
Expand All @@ -36,7 +35,7 @@ export const Header: React.FC = () => {
<Space>
{/*<Notifications/>*/}
{isAuthenticated ? <CurrentUser /> : null}
{!isAuthenticated ? <Link to={'login'}>Login</Link> : null}
{!isAuthenticated ? <Link to={'login'}>{loginMessage}</Link> : null}
</Space>
</BaseHeader>
)
Expand Down
2 changes: 0 additions & 2 deletions apps/web/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { BrandTitle } from '../BrandTitle'
import { Header } from './header'

export const Layout: React.FC<React.PropsWithChildren> = ({ children }) => {
console.log('Layout')

return (
// ThemedLayoutV2: https://refine.dev/docs/ui-integrations/ant-design/components/themed-layout/
// Header: https://refine.dev/docs/ui-integrations/ant-design/components/themed-layout/#header
Expand Down
3 changes: 2 additions & 1 deletion apps/web/providers/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
DEFAULT_LOCALE,
DEFAULT_NAMESPACE,
LOCALES,
IS_I18N_DEBUG_ENABLED,
} from '@repo/i18n'

import { IMPORTER } from './importer'
Expand All @@ -20,7 +21,7 @@ i18next
.use(LanguageDetector)
.use(resourcesToBackend(IMPORTER))
.init({
// debug: true,
debug: IS_I18N_DEBUG_ENABLED,
lng: undefined, // let detect the language on client side
fallbackLng: DEFAULT_LOCALE,
fallbackNS: DEFAULT_NAMESPACE,
Expand Down
Binary file added docs/_img/01-form-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export const LOCALE_COOKIE_NAME = 'NEXT_LOCALE'
export const LOCALES = ['en', 'ru']
export const DEFAULT_LOCALE = 'en'
export const DEFAULT_NAMESPACE = 'common'
export const IS_I18N_DEBUG_ENABLED = false
3 changes: 2 additions & 1 deletion packages/i18n/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import acceptLanguage from 'accept-language'
import {
DEFAULT_LOCALE,
DEFAULT_NAMESPACE,
IS_I18N_DEBUG_ENABLED,
LOCALE_COOKIE_NAME,
LOCALES,
} from './config'
Expand All @@ -32,7 +33,7 @@ const initI18next = async (
.use(initReactI18next)
.use(resourcesToBackend(importer))
.init({
debug: true,
debug: IS_I18N_DEBUG_ENABLED,
fallbackLng: DEFAULT_LOCALE,
fallbackNS: DEFAULT_NAMESPACE,
defaultNS: DEFAULT_NAMESPACE,
Expand Down

0 comments on commit 3ce1ece

Please sign in to comment.