diff --git a/src/app/components/LandingCTA.tsx b/src/app/components/LandingCTA.tsx index 18233a6ca..205f18ce4 100644 --- a/src/app/components/LandingCTA.tsx +++ b/src/app/components/LandingCTA.tsx @@ -1,11 +1,11 @@ import clx from 'classnames' - import { LoginButtonClient } from './LoginButton' import { ShowEmailJS } from './ShowEmailJS' +import { ReactNode } from 'react' export const LandingCTA: React.FC = () => { return ( -
+
@@ -20,7 +20,12 @@ const Card4Coders: React.FC = () => { return ( +
  • ☑️ Fix a bug.
  • +
  • ☑️ Use OpenBeta API & data in your projects.
  • + + } action={ <> Dev onboarding @@ -35,7 +40,12 @@ const Card4All: React.FC = () => { return ( +
  • ☑️ Add missing climbs.
  • +
  • ☑️ Help us make your local climbing's area page even better!
  • + + } action={} /> ) @@ -63,7 +73,7 @@ const Donate: React.FC = () => { interface CTACardProps { title: string - body: string + body: string | ReactNode action: React.ReactNode className?: string } @@ -71,10 +81,10 @@ interface CTACardProps { const Card: React.FC = ({ title, body, action, className }) => { return (
    -

    {title}

    +

    {title}

    -

    {body}

    +
    {body}
    {action}
    diff --git a/src/app/components/LandingHero.tsx b/src/app/components/LandingHero.tsx index 4387cbedb..d535cdb2f 100644 --- a/src/app/components/LandingHero.tsx +++ b/src/app/components/LandingHero.tsx @@ -1,13 +1,8 @@ -import Heart from '@/assets/icons/heart-hero' - export const LandingHero: React.FC = () => { return ( -
    -
    - Knowledge - + - You = -
    +
    +

    Share your climbing route knowledge!

    +

    Join OpenBeta and help build a community resource for climbers

    ) } diff --git a/src/app/components/RecentEdits.tsx b/src/app/components/RecentEdits.tsx index bdc0dfef8..f8cf8f061 100644 --- a/src/app/components/RecentEdits.tsx +++ b/src/app/components/RecentEdits.tsx @@ -1,9 +1,17 @@ +import Link from 'next/link' import { ArrowRightIcon } from '@heroicons/react/24/outline' import { getChangeHistoryServerSide } from '@/js/graphql/contribAPI' -import { ChangesetRow } from '@/components/edit/RecentChangeHistory' -import Link from 'next/link' +import { ChangesetCard } from '@/components/edit/RecentChangeHistory' + +/** + * Cache time in seconds + */ +export const revalidate = 300 +/** + * Show most recent edits + */ export const RecentEdits: React.FC = async () => { const history = await getChangeHistoryServerSide() return ( @@ -15,7 +23,9 @@ export const RecentEdits: React.FC = async () => {
    {history.splice(0, 10).map(changetset => - )} + + )} +
    See more @@ -23,3 +33,22 @@ export const RecentEdits: React.FC = async () => {
    ) } + +/** + * 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/components/RecentTags.tsx b/src/app/components/RecentTags.tsx index bbce08bc0..c337553ab 100644 --- a/src/app/components/RecentTags.tsx +++ b/src/app/components/RecentTags.tsx @@ -1,6 +1,11 @@ import { RecentImageCard } from '@/components/home/RecentMediaCard' import { getMediaForFeed } from '@/js/graphql/api' +/** + * Cache time in seconds + */ +export const revalidate = 300 + /** * Horizontal gallery of recent images with tags */ @@ -19,12 +24,12 @@ export const RecentTags: React.FC = async () => { }) return ( -
    +

    Recent Tags

    -
    +

    { diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 440854d65..86a754721 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -11,7 +11,8 @@ export const metadata: Metadata = { openGraph: { description: 'OpenBeta is a free climbing platform. Join the community and share your knowledge today.', images: '/south-africa-og.jpeg' - } + }, + metadataBase: new URL(`https://${process.env.VERCEL_URL ?? 'http://localhost:3000'}`) } export default function RootLayout ({ diff --git a/src/app/page.tsx b/src/app/page.tsx index a8711eb83..77f94af73 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,20 +1,26 @@ +import { Suspense } from 'react' import { LandingCTA } from './components/LandingCTA' import { LandingHero } from './components/LandingHero' -import { RecentEdits } from './components/RecentEdits' +import { RecentEdits, RecentEditsSkeleton } from './components/RecentEdits' import { RecentTags } from './components/RecentTags' import { USAToC } from './components/USAToC' +/** + * Root home page + */ export default async function Home (): Promise { return (
    -
    +

    Our website is undergoing a facelift. Visit the old home.
    Questions or comments? hello@openbeta.io

    - + }> + +
    diff --git a/src/components/edit/RecentChangeHistory.tsx b/src/components/edit/RecentChangeHistory.tsx index 6f8d25946..59a254a0a 100644 --- a/src/components/edit/RecentChangeHistory.tsx +++ b/src/components/edit/RecentChangeHistory.tsx @@ -9,10 +9,14 @@ import { ChangesetType, ChangeType, AreaType, ClimbType, OrganizationType, Docum export interface RecentChangeHistoryProps { history: ChangesetType[] } + +/** + * Show all changes + */ export default function RecentChangeHistory ({ history }: RecentChangeHistoryProps): JSX.Element { return (
    - {history.map(changetset => )} + {history.map(changetset => )}
    ) } @@ -21,7 +25,10 @@ interface ChangsetRowProps { changeset: ChangesetType } -export const ChangesetRow = ({ changeset }: ChangsetRowProps): JSX.Element => { +/** + * A card showing individual changeset + */ +export const ChangesetCard: React.FC = ({ changeset }) => { const { createdAt, editedByUser, operation, changes } = changeset // @ts-expect-error @@ -186,13 +193,6 @@ const ActionIcon = ({ icon, clz }: ActionIconProps): JSX.Element => (
    {icon}
    ) -interface OpBadgeProps { - label: string - clz?: string -} - -const OpBadge = ({ label, clz = 'badge-outline' }: OpBadgeProps): JSX.Element => {label} - const operationLabelMap = { addArea: { borderCue: 'border-l-green-500', @@ -235,15 +235,18 @@ const operationLabelMap = { icon: } /> }, addOrganization: { - badge: , + badge: 'added an organization', + borderCue: 'border-l-green-500', icon: } clz='bg-success' /> }, updateOrganization: { - badge: , + badge: 'updated an organization', + borderCue: 'border-l-black', icon: } /> }, deleteOrganization: { - badge: , + badge: 'deleted an organization', + borderCue: 'border-l-pink-500', icon: } clz='bg-error' /> } } diff --git a/src/components/ui/Card/Card.tsx b/src/components/ui/Card/Card.tsx index e28cf9349..3ed9eb6ba 100644 --- a/src/components/ui/Card/Card.tsx +++ b/src/components/ui/Card/Card.tsx @@ -17,7 +17,7 @@ export default function Card ({ bordered = false }: CardProps): JSX.Element { return ( -
    +
    {header}
    {image}