generated from ocadotechnology/codeforlife-template-frontend
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rename page * new package version * fix scope * fix login flow * sign latest agreement form * add header * flow fix * fix header * fix api calls * fix sign latest agreement * tidy up * new cfl package * fix date format * redirect to home page if not found * feedback
- Loading branch information
Showing
18 changed files
with
746 additions
and
584 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
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,14 +1,15 @@ | ||
import { type FC } from "react" | ||
import { App as _ } from "codeforlife/components" | ||
|
||
import { Header } from "./components" | ||
import routes from "./routes" | ||
import store from "./app/store" | ||
import theme from "./app/theme" | ||
|
||
export interface AppProps {} | ||
|
||
const App: FC<AppProps> = () => ( | ||
<_ store={store} theme={theme} routes={routes} /> | ||
<_ store={store} theme={theme} routes={routes} header={<Header />} /> | ||
) | ||
|
||
export default App |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Avatar, Link, Paper, Stack } from "@mui/material" | ||
import { type FC } from "react" | ||
import { Image } from "codeforlife/components" | ||
import { LinkButton } from "codeforlife/components/router" | ||
import { handleResultState } from "codeforlife/utils/api" | ||
|
||
import { type SessionMetadata, useSessionMetadata } from "../app/hooks" | ||
import CflLogoImage from "../images/cfl_logo.png" | ||
import { LINK_CFL } from "../app/env" | ||
import { useLogoutMutation } from "../api" | ||
import { useRetrieveContributorQuery } from "../api/contributor" | ||
|
||
const Profile: FC<SessionMetadata> = ({ contributor_id }) => { | ||
const avatarSize = 50 | ||
|
||
return handleResultState( | ||
useRetrieveContributorQuery(contributor_id), | ||
contributor => ( | ||
<LinkButton | ||
to={contributor.html_url} | ||
target="_blank" | ||
endIcon={ | ||
<Avatar | ||
alt={contributor.name} | ||
src={contributor.avatar_url} | ||
sx={{ width: avatarSize, height: avatarSize }} | ||
/> | ||
} | ||
sx={{ | ||
height: avatarSize + 5, | ||
fontSize: 20, | ||
margin: "0 auto", | ||
backgroundColor: "transparent", | ||
"&:hover": { backgroundColor: "transparent" }, | ||
}} | ||
> | ||
{contributor.name} | ||
</LinkButton> | ||
), | ||
) | ||
} | ||
|
||
export interface HeaderProps {} | ||
|
||
const Header: FC<HeaderProps> = () => { | ||
const [logout] = useLogoutMutation() | ||
const sessionMetadata = useSessionMetadata() | ||
|
||
return ( | ||
<Paper sx={{ position: "sticky", top: 0, borderRadius: 0 }}> | ||
<Stack | ||
direction="row" | ||
marginTop={1} | ||
marginBottom={1} | ||
marginLeft={2} | ||
marginRight={2} | ||
alignItems="center" | ||
> | ||
<Image | ||
src={CflLogoImage} | ||
alt="code for life logo" | ||
maxWidth={{ xs: "65px", lg: "80px" }} | ||
href={LINK_CFL} | ||
hrefInNewTab | ||
/> | ||
{sessionMetadata && ( | ||
<Stack direction="row" gap={2} alignItems="center" marginLeft="auto"> | ||
<Link | ||
onClick={() => { | ||
void logout(null) | ||
}} | ||
> | ||
Log out | ||
</Link> | ||
<Profile {...sessionMetadata} /> | ||
</Stack> | ||
)} | ||
</Stack> | ||
</Paper> | ||
) | ||
} | ||
|
||
export default Header |
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,2 @@ | ||
export { default as Header } from "./Header" | ||
export * from "./Header" |
32 changes: 0 additions & 32 deletions
32
src/pages/agreementSignatureList/AgreementSignatureList.tsx
This file was deleted.
Oops, something went wrong.
64 changes: 0 additions & 64 deletions
64
src/pages/agreementSignatureList/AgreementSignatureTable.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.