Skip to content

Commit

Permalink
Add contributor endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
SalmanAsh committed Aug 23, 2024
1 parent 7c30b5b commit ee27954
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 35 deletions.
Empty file added src/api/agreementSignature.ts
Empty file.
4 changes: 2 additions & 2 deletions src/api/contributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export type Contributor = Model<
{
email: string
name: string
location: string
location?: string
html_url: string
avatar_url: string
last_login: Date
last_login?: Date
}
>

Expand Down
3 changes: 0 additions & 3 deletions src/app/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
import * as yup from "yup"

export const fruitNameSchema = yup.string().max(50)
19 changes: 0 additions & 19 deletions src/components/FruitNameField.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/components/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
export { default as FruitNameField } from "./FruitNameField"
export * from "./FruitNameField"
Empty file.
Empty file.
24 changes: 17 additions & 7 deletions src/pages/contributorDetail/ContributorDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as forms from "codeforlife/components/form"
import * as pages from "codeforlife/components/page"
import * as yup from "yup"
import { Typography } from "@mui/material"
import { Stack, Typography } from "@mui/material"
// eslint-disable-next-line sort-imports
import { type FC } from "react"
import { Link } from "codeforlife/components/router"
Expand All @@ -24,11 +23,22 @@ const ContributorDetail: FC<ContributorDetailProps> = () => {
handleQueryState(retrieveContributorResult, contributor => (
<pages.Page>
<pages.Section>
<Typography variant="h1">Contributor details</Typography>
<forms.Form
initialValues={contributor}
onSubmit={alert}
></forms.Form>
<Typography variant="h1">{contributor.name} details</Typography>
<Stack spacing={2}>
<Typography variant="h6">Name: {contributor.name}</Typography>
<Typography variant="h6">Email: {contributor.email}</Typography>
{contributor.location && (
<Typography variant="h6">
Location: {contributor.location}
</Typography>
)}
<Typography variant="h6">
html_url: {contributor.html_url}
</Typography>
<Typography variant="h6">
avatar_url: {contributor.avatar_url}
</Typography>
</Stack>
</pages.Section>
<pages.Section>
<Link className="back-to" to={paths.contributors._}>
Expand Down
2 changes: 0 additions & 2 deletions src/pages/contributorList/ContributorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ const ContributorList: FC<ContributorListProps> = () => {
{contributor.name} ({contributor.email})
</Typography>

{/* Added an icon to the LinkIconButton for better UX */}
<LinkIconButton
to={generatePath(paths.contributors.id._, {
id: contributor.id,
})}
>
{/* You can replace 'View' with an icon component like <Icon>eye</Icon> if desired */}
<Typography>View</Typography>
</LinkIconButton>
</Stack>
Expand Down

0 comments on commit ee27954

Please sign in to comment.