diff --git a/apps/frontend/src/app.tsx b/apps/frontend/src/app.tsx new file mode 100644 index 00000000..0cc8d130 --- /dev/null +++ b/apps/frontend/src/app.tsx @@ -0,0 +1,17 @@ +import { Header } from './components/header'; +import { Footer } from './components/footer'; +import { UsaBanner } from './components/usa-banner'; +import { HomePage } from './routes'; +import { useAppContext } from './context'; + +export const App = () => { + const context = useAppContext(); + return ( +
+ +
+ +
+ ); +}; diff --git a/apps/frontend/src/views/components/document-assembler.tsx b/apps/frontend/src/components/document-assembler.tsx similarity index 100% rename from apps/frontend/src/views/components/document-assembler.tsx rename to apps/frontend/src/components/document-assembler.tsx diff --git a/apps/frontend/src/components/footer.tsx b/apps/frontend/src/components/footer.tsx new file mode 100644 index 00000000..d3d26d67 --- /dev/null +++ b/apps/frontend/src/components/footer.tsx @@ -0,0 +1,53 @@ +import { type GithubRepository, getBranchTreeUrl } from '../lib/github'; + +type FooterProps = { + github: GithubRepository; +}; + +export const Footer = (props: FooterProps) => { + return ( + + ); +}; diff --git a/apps/frontend/src/views/components/header.tsx b/apps/frontend/src/components/header.tsx similarity index 100% rename from apps/frontend/src/views/components/header.tsx rename to apps/frontend/src/components/header.tsx diff --git a/apps/frontend/src/views/components/usa-banner.tsx b/apps/frontend/src/components/usa-banner.tsx similarity index 100% rename from apps/frontend/src/views/components/usa-banner.tsx rename to apps/frontend/src/components/usa-banner.tsx diff --git a/apps/frontend/src/views/context.tsx b/apps/frontend/src/context.tsx similarity index 82% rename from apps/frontend/src/views/context.tsx rename to apps/frontend/src/context.tsx index 7c691138..75cc61b2 100644 --- a/apps/frontend/src/views/context.tsx +++ b/apps/frontend/src/context.tsx @@ -1,4 +1,5 @@ import { createContext, useContext } from 'react'; +import { GithubRepository } from './lib/github'; export interface Backend { helloWorld(echoValue: string): string; @@ -6,10 +7,12 @@ export interface Backend { export interface Context { backend: Backend; + github: GithubRepository; } export const AppContext = createContext({ backend: {} as Backend, + github: {} as GithubRepository, }); export const useAppContext = () => { diff --git a/apps/frontend/src/views/index.scss b/apps/frontend/src/index.scss similarity index 100% rename from apps/frontend/src/views/index.scss rename to apps/frontend/src/index.scss diff --git a/apps/frontend/src/index.ts b/apps/frontend/src/index.ts index 323fd4b2..cccef888 100644 --- a/apps/frontend/src/index.ts +++ b/apps/frontend/src/index.ts @@ -1,7 +1,8 @@ -import { createAppRoot } from './views/main'; +import { createAppRoot } from './main'; createAppRoot(document.getElementById('root') as HTMLElement, { backend: { helloWorld: (str: string) => str, }, + github: import.meta.env.GITHUB, }); diff --git a/apps/frontend/src/lib/github.ts b/apps/frontend/src/lib/github.ts new file mode 100644 index 00000000..0347ae4d --- /dev/null +++ b/apps/frontend/src/lib/github.ts @@ -0,0 +1,27 @@ +export type GithubRepository = { + owner: string; + repository: string; + branch: string; + commit: string; +}; + +export const DEFAULT_REPOSITORY: GithubRepository = { + owner: 'gsa-tts', + repository: 'atj-platform', + branch: 'main', + commit: 'main', +}; + +export const getBranchTreeUrl = ( + github: GithubRepository, + useDefaultShortForm = true +) => { + if (useDefaultShortForm && github.branch === DEFAULT_REPOSITORY.branch) { + return `https://github.com/${github.owner}/${github.repository}`; + } + return `https://github.com/${github.owner}/${github.repository}/tree/${github.branch}`; +}; + +export const getNewIssueUrl = (github: GithubRepository) => { + return `https://github.com/${github.owner}/${github.repository}/issues/new/choose`; +}; diff --git a/apps/frontend/src/views/main.tsx b/apps/frontend/src/main.tsx similarity index 100% rename from apps/frontend/src/views/main.tsx rename to apps/frontend/src/main.tsx diff --git a/apps/frontend/src/views/pages/index.tsx b/apps/frontend/src/routes/index.tsx similarity index 100% rename from apps/frontend/src/views/pages/index.tsx rename to apps/frontend/src/routes/index.tsx diff --git a/apps/frontend/src/views/app.tsx b/apps/frontend/src/views/app.tsx deleted file mode 100644 index 72159c7e..00000000 --- a/apps/frontend/src/views/app.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Header } from './components/header'; -import { UsaBanner } from './components/usa-banner'; -import { HomePage } from './pages'; - -export const App = () => { - return ( -
- -
- <> - - -
- ); -}; diff --git a/apps/frontend/src/views/vite-env.d.ts b/apps/frontend/src/vite-env.d.ts similarity index 100% rename from apps/frontend/src/views/vite-env.d.ts rename to apps/frontend/src/vite-env.d.ts