diff --git a/src/app/components/LatestContributions.tsx b/src/app/components/LatestContributions.tsx new file mode 100644 index 000000000..54d02358a --- /dev/null +++ b/src/app/components/LatestContributions.tsx @@ -0,0 +1,50 @@ +import { ReactNode } from 'react' +import Link from 'next/link' +import { ArrowRightIcon } from '@heroicons/react/24/outline' + +import { getChangeHistoryServerSide } from '@/js/graphql/contribAPI' +import { ChangesetCard } from '@/components/edit/RecentChangeHistory' + +/** + * Show most recent contributions + */ +export const LatestContributions: React.FC = async () => { + const history = await getChangeHistoryServerSide() + return ( + + {history.splice(0, 10).map(changetset => + + )} + + ) +} + +/** + * Resuable container for actual and skeleton + */ +const Container: React.FC<{ children: ReactNode }> = ({ children }) => ( +
+
+

Latest contributions

+ See more +
+
+
+ {children} +
+
+ See more +
+
+) + +/** + * Loading skelton + */ +export const LatestContributionsSkeleton: React.FC = () => { + return ( + + {[1, 2, 3, 4, 5].map(item =>
)} + + ) +} diff --git a/src/app/components/RecentEdits.tsx b/src/app/components/RecentEdits.tsx deleted file mode 100644 index abad1a7a2..000000000 --- a/src/app/components/RecentEdits.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import Link from 'next/link' -import { ArrowRightIcon } from '@heroicons/react/24/outline' - -import { getChangeHistoryServerSide } from '@/js/graphql/contribAPI' -import { ChangesetCard } from '@/components/edit/RecentChangeHistory' - -/** - * Show most recent edits - */ -export const RecentEdits: React.FC = async () => { - const history = await getChangeHistoryServerSide() - return ( -
-
-

Latest contributions

- See more -
-
-
- {history.splice(0, 10).map(changetset => - - )} - -
-
- See more -
-
- ) -} - -/** - * Loading skelton. - * Todo: somehow reuse the structure and css from the real component - */ -export const RecentEditsSkeleton: React.FC = () => { - return ( -
-
-

Recent edits

- See more -
-
-
- {[1, 2, 3, 4, 5].map(item =>
)} -
-
- ) -} diff --git a/src/app/page.tsx b/src/app/page.tsx index 6af99259f..4cfddd8b2 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,7 +1,7 @@ import { Suspense } from 'react' import { LandingCTA } from './components/LandingCTA' import { LandingHero } from './components/LandingHero' -import { RecentEdits, RecentEditsSkeleton } from './components/RecentEdits' +import { LatestContributions, LatestContributionsSkeleton } from './components/LatestContributions' import { FinancialContributors } from './components/FinancialContributors' import { RecentTags } from './components/RecentTags' import { USAToC } from './components/USAToC' @@ -26,8 +26,8 @@ export default async function Home (): Promise {
- }> - + }> +
diff --git a/src/components/edit/RecentChangeHistory.tsx b/src/components/edit/RecentChangeHistory.tsx index 59a254a0a..f8ec83994 100644 --- a/src/components/edit/RecentChangeHistory.tsx +++ b/src/components/edit/RecentChangeHistory.tsx @@ -94,7 +94,6 @@ const ClimbChange = ({ changeId, fullDocument, updateDescription, dbOp }: Change - {/*
{JSON.stringify(updateDescription?.updatedFields)}
*/} ) } @@ -200,7 +199,7 @@ const operationLabelMap = { icon: } clz='bg-success' /> }, updateArea: { - borderCue: 'border-l-black', + borderCue: 'border-l-neutral', badge: 'edited an area', icon: } /> }, @@ -215,7 +214,8 @@ const operationLabelMap = { icon: } clz='bg-error' /> }, updateDestination: { - badge: 'badge-warning', + borderCue: 'border-l-neutral', + badge: 'set destination', icon: } /> }, @@ -230,7 +230,7 @@ const operationLabelMap = { icon: } clz='bg-error' /> }, updateClimb: { - borderCue: 'border-l-black', + borderCue: 'border-l-neutral', badge: 'updated a climb', icon: } /> }, @@ -241,7 +241,7 @@ const operationLabelMap = { }, updateOrganization: { badge: 'updated an organization', - borderCue: 'border-l-black', + borderCue: 'border-l-neutral', icon: } /> }, deleteOrganization: {