Skip to content

Commit

Permalink
Add base structure for the home page
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinNagpal committed Feb 19, 2025
1 parent 63cdaed commit b3f0453
Show file tree
Hide file tree
Showing 45 changed files with 1,029 additions and 34 deletions.
36 changes: 36 additions & 0 deletions insights-ui/src/app/crowd-funding/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import getBaseUrl from '@dodao/web-core/utils/api/getBaseURL';
import { Grid4Cols } from '@dodao/web-core/components/core/grids/Grid4Cols';
import React from 'react';
import PageWrapper from '@dodao/web-core/components/core/page/PageWrapper';
import ProjectSummaryCard from '@/components/projects/ProjectSummaryCard';
import AddProjectButton from '@/components/ui/AddProjectButton';
import PrivateWrapper from '@/components/auth/PrivateWrapper';

export default async function Home() {
const apiUrl = `${getBaseUrl()}/api/crowd-funding/projects`;
const res = await fetch(apiUrl, { cache: 'no-cache' });
const data = await res.json();

return (
<PageWrapper>
<div className="mx-auto">
<div className="text-center my-5">
<div className="sm:flex-auto">
<h1 className="font-semibold leading-6 text-2xl text-color">Crowd Funding Projects</h1>
<p className="my-2 text-sm text-color">A list of all the projects.</p>
</div>
</div>
<PrivateWrapper>
<AddProjectButton />
</PrivateWrapper>
<Grid4Cols>
{data.projectIds!.length > 0 ? (
data.projectIds.map((projectId: string) => <ProjectSummaryCard key={projectId} projectId={projectId} />)
) : (
<div className="text-color text-center">No projects to show</div>
)}
</Grid4Cols>
</div>
</PageWrapper>
);
}
48 changes: 47 additions & 1 deletion insights-ui/src/app/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,52 @@
@tailwind components;
@tailwind utilities;

@theme {
//--shadow-*: initial;
--shadow-sm: 0 2px 6px rgb(15 23 42 / 0.08);
--shadow-md: 0 8px 8px rgb(15 23 42 / 0.05), 0 3px 6px rgb(15 23 42 / 0.05);
--shadow-lg: 0 8px 15px rgb(15 23 42 / 0.08), 0 3px 6px rgb(15 23 42 / 0.08);
--shadow-xl: 2px 11px 16px rgb(15 23 42 / 0.17),
0 1px 6px rgb(15 23 42 / 0.17), 3px 23px 24px rgb(15 23 42 / 0.17);

//--text-*: initial;
--text-xs: 0.75rem;
--text-xs--line-height: 1rem;
--text-sm: 0.875rem;
--text-sm--line-height: 1.5rem;
--text-base: 1rem;
--text-base--line-height: 2rem;
--text-lg: 1.125rem;
--text-lg--line-height: 2rem;
--text-xl: 1.25rem;
--text-xl--line-height: 2rem;
--text-2xl: 1.375rem;
--text-2xl--line-height: 2rem;
--text-3xl: 1.5rem;
--text-3xl--line-height: 2rem;
--text-4xl: 2rem;
--text-4xl--line-height: 2.5rem;
--text-5xl: 3.5rem;
--text-5xl--line-height: 1;
--text-6xl: 4rem;
--text-6xl--line-height: 1;
--text-7xl: 4.5rem;
--text-7xl--line-height: 1;
--text-8xl: 6rem;
--text-8xl--line-height: 1;
--text-9xl: 8rem;
--text-9xl--line-height: 1;

--radius-4xl: 2rem;
--radius-5xl: 3rem;
--radius-6xl: 5rem;

--font-sans: var(--font-inter);
--font-display: Cabinet Grotesk, ui-sans-serif, system-ui, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}


body {
font-family: 'Inter', sans-serif;
}
Expand All @@ -16,4 +62,4 @@ body {

.markdown table {
all: unset; /* Exclude tables from 'revert' */
}
}
15 changes: 13 additions & 2 deletions insights-ui/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import clsx from 'clsx';
import type { Metadata } from 'next';
import { Geist, Geist_Mono } from 'next/font/google';
import { Geist, Geist_Mono, Inter } from 'next/font/google';
import 'tailwindcss/tailwind.css';
import './globals.scss';
import { CSSProperties } from 'react';
Expand All @@ -19,6 +20,12 @@ export const metadata: Metadata = {
description: 'Agents progress and reports',
};

const inter = Inter({
subsets: ['latin'],
display: 'swap',
variable: '--font-inter',
});

export default function RootLayout({
children,
}: Readonly<{
Expand All @@ -37,7 +44,11 @@ export default function RootLayout({
} as CSSProperties;

return (
<html lang="en">
<html lang="en" className={clsx('h-full scroll-smooth bg-white antialiased', inter.variable)}>
<head>
<link rel="preconnect" href="https://cdn.fontshare.com" crossOrigin="anonymous" />
<link rel="stylesheet" href="https://api.fontshare.com/v2/css?f[]=cabinet-grotesk@800,500,700&display=swap" />
</head>
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`} style={{ ...style, backgroundColor: 'var(--bg-color)' }}>
{children}
</body>
Expand Down
22 changes: 22 additions & 0 deletions insights-ui/src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Link from 'next/link';

import { Container } from '@/components/home-page/Container';
import { GridPattern } from '@/components/home-page/GridPattern';

export default function NotFound() {
return (
<div className="relative flex flex-auto items-center">
<div className="absolute inset-0 -z-10 text-slate-900/10 [mask-image:linear-gradient(transparent,white,transparent)]">
<GridPattern x="50%" y="50%" patternTransform="translate(0 60)" />
</div>
<Container className="flex flex-col items-center py-16 text-center sm:py-20 lg:py-32">
<p className="rounded-full px-4 py-1 text-base font-medium tracking-tight text-slate-900 ring-1 ring-slate-900 ring-inset">404</p>
<h1 className="mt-6 font-display text-5xl font-extrabold text-slate-900 sm:text-6xl">Page not found</h1>
<p className="mt-4 text-lg tracking-tight text-slate-700">Sorry, we couldn’t find the page you’re looking for.</p>
<Link href="/" className="mt-6 text-base font-medium text-blue-600 hover:text-blue-800">
Go back home <span aria-hidden="true">&rarr;</span>
</Link>
</Container>
</div>
);
}
57 changes: 26 additions & 31 deletions insights-ui/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
import getBaseUrl from '@dodao/web-core/utils/api/getBaseURL';
import { Grid4Cols } from '@dodao/web-core/components/core/grids/Grid4Cols';
import React from 'react';
import PageWrapper from '@dodao/web-core/components/core/page/PageWrapper';
import ProjectSummaryCard from '@/components/projects/ProjectSummaryCard';
import AddProjectButton from '@/components/ui/AddProjectButton';
import PrivateWrapper from '@/components/auth/PrivateWrapper';
import AllInOnePlatform from '@/components/home-page/AllInOnePlatform';
import Features from '@/components/home-page/Features';
import { Footer } from '@/components/home-page/Footer';
import { Hero } from '@/components/home-page/Hero';
import Highlights from '@/components/home-page/Highlights';
import { CSSProperties } from 'react';

export default async function Home() {
const apiUrl = `${getBaseUrl()}/api/crowd-funding/projects`;
const res = await fetch(apiUrl, { cache: 'no-cache' });
const data = await res.json();
const style: CSSProperties = {
'--primary-color': '#2563eb',
'--primary-text-color': '#fff',
'--bg-color': '#fff',
'--text-color': '#282c6e',
'--link-color': '#2563eb',
'--heading-color': '#ffffff',
'--border-color': '#282c6e',
'--block-bg': '#fff',
'--swiper-theme-color': '',
} as CSSProperties;

export default function Home() {
return (
<PageWrapper>
<div className="mx-auto">
<div className="text-center my-5">
<div className="sm:flex-auto">
<h1 className="font-semibold leading-6 text-2xl text-color">Crowd Funding Projects</h1>
<p className="my-2 text-sm text-color">A list of all the projects.</p>
</div>
</div>
<PrivateWrapper>
<AddProjectButton />
</PrivateWrapper>
<Grid4Cols>
{data.projectIds!.length > 0 ? (
data.projectIds.map((projectId: string) => <ProjectSummaryCard key={projectId} projectId={projectId} />)
) : (
<div className="text-color text-center">No projects to show</div>
)}
</Grid4Cols>
</div>
</PageWrapper>
<div style={{ ...style, backgroundColor: 'var(--bg-color)' }}>
<Hero />
<AllInOnePlatform />
<Features />
<Highlights />

<Footer />
</div>
);
}
55 changes: 55 additions & 0 deletions insights-ui/src/components/home-page/AllInOnePlatform.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const features = [
{
name: 'Push to deploy',
description:
'Aut illo quae. Ut et harum ea animi natus. Culpa maiores et sed sint et magnam exercitationem quia. Ullam voluptas nihil vitae dicta molestiae et. Aliquid velit porro vero.',
},
{
name: 'SSL certificates',
description:
'Mollitia delectus a omnis. Quae velit aliquid. Qui nulla maxime adipisci illo id molestiae. Cumque cum ut minus rerum architecto magnam consequatur. Quia quaerat minima.',
},
{
name: 'Simple queues',
description:
'Aut repellendus et officiis dolor possimus. Deserunt velit quasi sunt fuga error labore quia ipsum. Commodi autem voluptatem nam. Quos voluptatem totam.',
},
{
name: 'Advanced security',
description:
'Magnam provident veritatis odit. Vitae eligendi repellat non. Eum fugit impedit veritatis ducimus. Non qui aspernatur laudantium modi. Praesentium rerum error deserunt harum.',
},
{
name: 'Powerful API',
description:
'Sit minus expedita quam in ullam molestiae dignissimos in harum. Tenetur dolorem iure. Non nesciunt dolorem veniam necessitatibus laboriosam voluptas perspiciatis error.',
},
{
name: 'Database backups',
description:
'Ipsa in earum deserunt aut. Quos minus aut animi et soluta. Ipsum dicta ut quia eius. Possimus reprehenderit iste aspernatur ut est velit consequatur distinctio.',
},
];

export default function AllInOnePlatform() {
return (
<div className="bg-white py-24 sm:py-32">
<div className="mx-auto max-w-7xl px-6 lg:px-8">
<div className="mx-auto max-w-2xl lg:mx-0">
<h2 className="text-pretty text-4xl font-semibold tracking-tight text-gray-900 sm:text-5xl">All-in-one platform</h2>
<p className="mt-6 text-lg/8 text-gray-600">
Lorem ipsum dolor sit amet consect adipisicing elit. Possimus magnam voluptatum cupiditate veritatis in accusamus quisquam.
</p>
</div>
<dl className="mx-auto mt-16 grid max-w-2xl grid-cols-1 gap-x-8 gap-y-16 text-base/7 sm:grid-cols-2 lg:mx-0 lg:max-w-none lg:grid-cols-3">
{features.map((feature) => (
<div key={feature.name}>
<dt className="font-semibold text-gray-900">{feature.name}</dt>
<dd className="mt-1 text-gray-600">{feature.description}</dd>
</div>
))}
</dl>
</div>
</div>
);
}
62 changes: 62 additions & 0 deletions insights-ui/src/components/home-page/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import Link from 'next/link'
import clsx from 'clsx'

const baseStyles = {
solid:
'inline-flex justify-center rounded-md py-1 px-4 text-base font-semibold tracking-tight shadow-sm focus:outline-hidden',
outline:
'inline-flex justify-center rounded-md border py-[calc(--spacing(1)-1px)] px-[calc(--spacing(4)-1px)] text-base font-semibold tracking-tight focus:outline-hidden',
}

const variantStyles = {
solid: {
slate:
'bg-slate-900 text-white hover:bg-slate-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-slate-900 active:bg-slate-700 active:text-white/80 disabled:opacity-30 disabled:hover:bg-slate-900',
blue: 'bg-blue-600 text-white hover:bg-blue-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 active:bg-blue-700 active:text-white/80 disabled:opacity-30 disabled:hover:bg-blue-600',
white:
'bg-white text-blue-600 hover:text-blue-700 focus-visible:text-blue-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white active:bg-blue-50 active:text-blue-900/80 disabled:opacity-40 disabled:hover:text-blue-600',
},
outline: {
slate:
'border-slate-200 text-slate-900 hover:border-slate-300 hover:bg-slate-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-slate-600 active:border-slate-200 active:bg-slate-50 active:text-slate-900/70 disabled:opacity-40 disabled:hover:border-slate-200 disabled:hover:bg-transparent',
blue: 'border-blue-300 text-blue-600 hover:border-blue-400 hover:bg-blue-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 active:text-blue-600/70 disabled:opacity-40 disabled:hover:border-blue-300 disabled:hover:bg-transparent',
},
}

type ButtonProps = (
| {
variant?: 'solid'
color?: keyof typeof variantStyles.solid
}
| {
variant: 'outline'
color?: keyof typeof variantStyles.outline
}
) &
(
| Omit<React.ComponentPropsWithoutRef<typeof Link>, 'color'>
| (Omit<React.ComponentPropsWithoutRef<'button'>, 'color'> & {
href?: undefined
})
)

export function Button({ className, ...props }: ButtonProps) {
props.variant ??= 'solid'
props.color ??= 'slate'

className = clsx(
baseStyles[props.variant],
props.variant === 'outline'
? variantStyles.outline[props.color]
: props.variant === 'solid'
? variantStyles.solid[props.color]
: undefined,
className,
)

return typeof props.href === 'undefined' ? (
<button className={className} {...props} />
) : (
<Link className={className} {...props} />
)
}
16 changes: 16 additions & 0 deletions insights-ui/src/components/home-page/Container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import clsx from 'clsx'

const styles = {
xs: 'mx-auto px-4 sm:px-6 md:max-w-2xl md:px-4 lg:px-2',
sm: 'mx-auto px-4 sm:px-6 md:max-w-2xl md:px-4 lg:max-w-4xl lg:px-12',
md: 'mx-auto px-4 sm:px-6 md:max-w-2xl md:px-4 lg:max-w-5xl lg:px-8',
lg: 'mx-auto px-4 sm:px-6 md:max-w-2xl md:px-4 lg:max-w-7xl lg:px-8',
}

export function Container({
size = 'sm',
className,
...props
}: React.ComponentPropsWithoutRef<'div'> & { size?: keyof typeof styles }) {
return <div className={clsx(styles[size], className)} {...props} />
}
Loading

0 comments on commit b3f0453

Please sign in to comment.