-
Notifications
You must be signed in to change notification settings - Fork 42
feat: add config for admin folder #1333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e1f225f
3c87b33
54520ae
40c8024
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| .PHONY: dist test | ||
|
|
||
| build: dep dist | ||
|
|
||
| dist: | ||
| @pnpm run build | ||
|
|
||
| test: | ||
| @pnpm run test | ||
|
|
||
| dep: | ||
| @pnpm install |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| package ui | ||
| package adminui | ||
|
|
||
| import ( | ||
| "embed" | ||
| ) | ||
|
|
||
| //go:embed all:dist | ||
|
Check failure on line 7 in web/apps/admin-ui/embed.go
|
||
| var Assets embed.FS | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { useEffect } from 'react'; | ||
| import type { AdminConfig } from '../types'; | ||
|
|
||
| export function AdminPageTitle({ | ||
| title, | ||
| appName, | ||
| config | ||
| }: { | ||
| title?: string; | ||
| appName?: string; | ||
| config?: AdminConfig; | ||
| }) { | ||
| const titleAppName = appName || config?.title || 'Frontier Admin'; | ||
| const fullTitle = title ? `${title} | ${titleAppName}` : titleAppName; | ||
|
|
||
| useEffect(() => { | ||
| document.title = fullTitle; | ||
| return () => { | ||
| document.title = titleAppName; | ||
| }; | ||
| }, [fullTitle, titleAppName]); | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import '@raystack/apsara/style.css'; | ||
|
|
||
| export type { AdminConfig, AdminLoginProps } from './types'; | ||
| export { AdminPageTitle } from './components/PageTitle'; | ||
| export { AdminLogin } from './pages/auth/Login'; | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| "use client"; | ||
|
|
||
| import { Box, Flex, Image } from '@raystack/apsara'; | ||
| import { Header } from '../../../react/components/Header'; | ||
| import { MagicLink } from '../../../react/components/onboarding/magiclink'; | ||
| import { AdminPageTitle } from '../../components/PageTitle'; | ||
| import type { AdminLoginProps } from '../../types'; | ||
|
|
||
| export function AdminLogin({ config, logoIcon }: AdminLoginProps) { | ||
| return ( | ||
| <Flex> | ||
| <AdminPageTitle title="Login" config={config} /> | ||
| <Box style={{ width: '100%' }}> | ||
| <Flex | ||
| direction="column" | ||
| justify="center" | ||
| align="center" | ||
| style={{ | ||
| margin: 'auto', | ||
| height: '100vh', | ||
| width: '280px' | ||
| }} | ||
| > | ||
| <Flex direction="column" gap={5} style={{ width: '100%' }}> | ||
| <Header | ||
| logo={ | ||
| config?.logo ? ( | ||
| <Image | ||
| alt="logo" | ||
| src={config.logo} | ||
| width={80} | ||
| height={80} | ||
| style={{ borderRadius: 'var(--rs-space-3)' }} | ||
| /> | ||
| ) : ( | ||
| logoIcon | ||
| ) | ||
| } | ||
| title={`Login to ${config?.title || 'Frontier Admin'}`} | ||
| /> | ||
| <MagicLink open /> | ||
| </Flex> | ||
| </Flex> | ||
| </Box> | ||
| </Flex> | ||
| ); | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import type React from 'react'; | ||
|
|
||
| export type AdminConfig = { | ||
| title?: string; | ||
| logo?: string; | ||
| }; | ||
|
|
||
| export type AdminLoginProps = { | ||
| config?: AdminConfig; | ||
| logoIcon?: React.ReactNode; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dummy file just to test the new Admin folder. This will contain the exportable frontier admin files coming from ui folder.