-
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.
refactor(frontend): improve code readability
- Loading branch information
1 parent
6a2ba8c
commit 2a15ca5
Showing
60 changed files
with
105 additions
and
93 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
2 changes: 1 addition & 1 deletion
2
apps/frontend/src/app/page.module.css → apps/frontend/src/app/home/page.module.css
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Flex, ScrollArea } from '@radix-ui/themes' | ||
|
||
import { ImagePreview } from '@widgets/ImagePreview' | ||
import { SettingsPanel } from '@widgets/SettingsPanel' | ||
import { ProcessingFooter } from '@widgets/ProcessingFooter' | ||
import type { FlexDirection } from '@lib/theme' | ||
import styles from './page.module.css' | ||
|
||
const mainDirection: FlexDirection = { | ||
initial: 'column', | ||
md: 'row' | ||
} as const | ||
|
||
const HomePage = () => ( | ||
<Flex width='100%' align='center' direction='column' className={styles.root}> | ||
<ScrollArea scrollbars='vertical' size='1' className={styles.scrollArea}> | ||
<Flex asChild justify='end' direction={mainDirection} width='100%' className={styles.main}> | ||
<main> | ||
<ImagePreview /> | ||
<SettingsPanel /> | ||
</main> | ||
</Flex> | ||
</ScrollArea> | ||
|
||
<ProcessingFooter /> | ||
</Flex> | ||
) | ||
|
||
export default HomePage |
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,28 +1 @@ | ||
import { Flex, ScrollArea } from '@radix-ui/themes' | ||
|
||
import { Preview } from '@widgets/Preview' | ||
import { SettingsPanel } from '@widgets/SettingsPanel' | ||
import { AppFooter } from '@widgets/AppFooter' | ||
import type { FlexDirection } from '@lib/theme' | ||
import styles from './page.module.css' | ||
|
||
const mainDirection: FlexDirection = { | ||
initial: 'column', | ||
md: 'row' | ||
} as const | ||
|
||
const HomePage = () => ( | ||
<Flex width='100%' align='center' direction='column' className={styles.root}> | ||
<ScrollArea scrollbars='vertical' size='1' className={styles.scrollArea}> | ||
<Flex asChild justify='end' direction={mainDirection} width='100%' className={styles.main}> | ||
<main> | ||
<Preview /> | ||
<SettingsPanel /> | ||
</main> | ||
</Flex> | ||
</ScrollArea> | ||
<AppFooter /> | ||
</Flex> | ||
) | ||
|
||
export default HomePage | ||
export { default } from './home/page' |
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
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,20 +1,24 @@ | ||
'use client' | ||
|
||
import { useEffect } from 'react' | ||
|
||
const ESCAPE_KEY = 'Escape' | ||
|
||
export const useEscapeAction = ( | ||
callback: VoidFunction, | ||
options?: boolean | AddEventListenerOptions | ||
) => { | ||
useEffect(() => { | ||
const handleEscapeKeydown = (ev: KeyboardEvent) => { | ||
if (ev.key !== 'Escape') return | ||
if (ev.key !== ESCAPE_KEY) return | ||
|
||
callback() | ||
} | ||
|
||
window.addEventListener('keydown', handleEscapeKeydown, options) | ||
document.addEventListener('keydown', handleEscapeKeydown, options) | ||
|
||
return () => { | ||
window.removeEventListener('keydown', handleEscapeKeydown, options) | ||
document.removeEventListener('keydown', handleEscapeKeydown, options) | ||
} | ||
}, [callback, options]) | ||
} |
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
apps/frontend/src/widgets/AppFooter/AppFooterContentSkeleton/index.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.
2 changes: 1 addition & 1 deletion
2
...ilePreview/UploadedFilePreview.module.css → ...ilePreview/UploadedFilePreview.module.css
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 @@ | ||
export { ImagePreview } from './ImagePreview' |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
apps/frontend/src/widgets/ProcessingFooter/ProcessingFooter.tsx
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,18 @@ | ||
import dynamic from 'next/dynamic' | ||
import { Box } from '@radix-ui/themes' | ||
|
||
import { ProcessingFooterContentSkeleton } from './ProcessingFooterContentSkeleton' | ||
import styles from './ProcessingFooter.module.css' | ||
|
||
const ProcessingFooterContent = dynamic(() => import('./ProcessingFooterContent'), { | ||
ssr: false, | ||
loading: () => <ProcessingFooterContentSkeleton /> | ||
}) | ||
|
||
export const ProcessingFooter = () => ( | ||
<Box asChild height='var(--processing-footer-height)' width='100%' px='4' className={styles.root}> | ||
<footer> | ||
<ProcessingFooterContent /> | ||
</footer> | ||
</Box> | ||
) |
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.
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.
1 change: 1 addition & 0 deletions
1
apps/frontend/src/widgets/ProcessingFooter/ProcessingFooterContent/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 { default } from './ProcessingFooterContent' |
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
...tentSkeleton/AppFooterContentSkeleton.tsx → ...leton/ProcessingFooterContentSkeleton.tsx
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
5 changes: 5 additions & 0 deletions
5
apps/frontend/src/widgets/ProcessingFooter/ProcessingFooterContentSkeleton/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,5 @@ | ||
export { | ||
ProcessingFooterContentSkeleton, | ||
ButtonDownloadImageSkeleton, | ||
ButtonRequestSkeleton | ||
} from './ProcessingFooterContentSkeleton' |
Oops, something went wrong.