Skip to content

Commit

Permalink
feat(website): create projects page
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor committed Nov 3, 2023
1 parent 860b4bf commit 90a08c6
Show file tree
Hide file tree
Showing 13 changed files with 286 additions and 26 deletions.
Binary file added apps/website/public/section-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/website/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function Home() {
bgRepeat="no-repeat"
/>

<VStack>
<VStack spacing="4">
<Heading fontSize="72px" textAlign="center">
Anonymous interactions
</Heading>
Expand Down
41 changes: 41 additions & 0 deletions apps/website/src/app/projects/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Box, Heading, Text, VStack } from "@chakra-ui/react"
import ActionCard from "../../components/ActionCard"
import ProjectsList from "@/components/ProjectsList"

export default function Projects() {
return (
<VStack>
<VStack h="393" w="100%" justify="end" align="left" spacing="40">
<Box
zIndex="-1"
left="0"
w="100%"
h="393"
pos="absolute"
bgImg="url('./section-3.png')"
bgSize="100%"
bgPos="center"
bgRepeat="no-repeat"
/>

<VStack align="left" spacing="4" pb="16">
<Heading fontSize="72px">Built with Semaphore</Heading>
<Text fontSize="20px">
Discover a curated showcase of innovative projects <br /> and applications developed using the
Semaphore Protocol.
</Text>
</VStack>
</VStack>

<ProjectsList w="100%" align="left" pt="16" spacing="14" />

<VStack my={"128"}>
<ActionCard
title="Show what you have built"
description="We are missing your project! Add your project to this page and show your awesomeness to the world."
buttonText="Submit your project"
/>
</VStack>
</VStack>
)
}
4 changes: 3 additions & 1 deletion apps/website/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export default function Navbar() {

return (
<HStack py="7" justify="space-between">
<Image width="148" height="40" src="./semaphore-logo.svg" alt="Semaphore logo" />
<Link as={NextLink} href="/">
<Image width="148" height="40" src="./semaphore-logo.svg" alt="Semaphore logo" />
</Link>
<HStack fontSize="18px" spacing="10">
<Link
as={NextLink}
Expand Down
4 changes: 3 additions & 1 deletion apps/website/src/components/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export default function ProjectCard({ tags, title, description }: ProjectCardPro
>
<HStack gap={"8px"} mb={"2rem"}>
{tags.map((tag, i) => (
<Tag key={i}>{tag}</Tag>
<Tag variant="outline" key={i}>
{tag}
</Tag>
))}
</HStack>
<CardBody padding={0}>
Expand Down
10 changes: 5 additions & 5 deletions apps/website/src/components/ProjectsCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import { circularSlice } from "../utils/circularSlice"
import ProjectCard from "./ProjectCard"

export default function ProjectsCarousel() {
const [projects, setCarouselProjects] = useState<typeof allProjects>(allProjects.slice(0, 3))
const [index, setCarouselIndex] = useState<number>(0)
const [projects, setProjects] = useState<typeof allProjects>(allProjects.slice(0, 3))
const [index, setIndex] = useState<number>(0)

useEffect(() => {
setCarouselProjects(circularSlice(projects, index, 3))
setProjects(circularSlice(projects, index, 3))
}, [index])

const nextProject = useCallback(() => {
setCarouselIndex((i) => (i + 1) % projects.length)
setIndex((i) => (i + 1) % projects.length)
}, [index])

const previousProject = useCallback(() => {
setCarouselIndex((i) => (i === 0 ? projects.length - 1 : i - 1))
setIndex((i) => (i === 0 ? projects.length - 1 : i - 1))
}, [index])

return (
Expand Down
119 changes: 119 additions & 0 deletions apps/website/src/components/ProjectsList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
"use client"

import { Button, Grid, GridItem, HStack, IconButton, Link, Text, VStack } from "@chakra-ui/react"
import { useCallback, useEffect, useState } from "react"
import ProjectCard from "../components/ProjectCard"
import allProjects from "../data/projects.json"
import IconChevronLeft from "../icons/IconChevronLeft"
import IconChevronRight from "../icons/IconChevronRight"
import IconCommunity from "../icons/IconCommunity"
import { chunkArray } from "../utils/chunkArray"
import { getProjectTags } from "../utils/getProjectTags"

export default function ProjectsList(props: any) {
const [projects, setProjects] = useState<(typeof allProjects)[]>(chunkArray(allProjects))
const [index, setIndex] = useState<number>(0)
const [selectedTag, setSelectedTag] = useState<string | null>(null)
const [onlyPSE, setOnlyPSE] = useState<boolean | null>(null)

const filterProjects = useCallback(() => {
let filteredProjects = allProjects

if (selectedTag) {
filteredProjects = allProjects.filter((project) => project.tags.includes(selectedTag))
}

if (onlyPSE === true) {
filteredProjects = allProjects.filter((project) => project.pse)
} else if (onlyPSE === false) {
filteredProjects = allProjects.filter((project) => !project.pse)
}

setProjects(chunkArray(filteredProjects))
}, [selectedTag, onlyPSE])

useEffect(() => {
filterProjects()
}, [selectedTag, onlyPSE])

return (
<VStack {...props}>
<VStack align="left" spacing="6">
<Text fontSize="20">Projects created by</Text>

<HStack spacing="4">
<Button
size="lg"
variant={onlyPSE === true ? "solid" : "outline"}
colorScheme={onlyPSE === true ? "primary" : "inherit"}
onClick={() => setOnlyPSE(onlyPSE === true ? null : true)}
>
PSE
</Button>
<Button
size="lg"
leftIcon={<IconCommunity />}
variant={onlyPSE === false ? "solid" : "outline"}
colorScheme={onlyPSE === false ? "primary" : "inherit"}
onClick={() => setOnlyPSE(onlyPSE === false ? null : false)}
>
Community
</Button>
</HStack>
</VStack>

<HStack spacing="5">
<Text fontSize="20">Category</Text>

<HStack spacing="3">
{getProjectTags(allProjects).map((tag) => (
<Button
key={tag}
size="sm"
variant={tag === selectedTag ? "solid" : "outline"}
colorScheme={tag === selectedTag ? "primary" : "inherit"}
onClick={() => setSelectedTag(tag === selectedTag ? null : tag)}
>
{tag}
</Button>
))}
</HStack>
</HStack>

<Grid templateColumns="repeat(3, 1fr)" gap={6}>
{projects[index].map((project, i) => (
<GridItem key={project.name + i}>
<Link href={project.links.github} target="_blank">
<ProjectCard title={project.name} description={project.tagline} tags={project.tags} />
</Link>
</GridItem>
))}
</Grid>

{projects.length > 1 && (
<HStack w="100%">
<HStack flex="1" justify="center">
{index > 0 && <IconButton variant="link" aria-label="Arrow left" icon={<IconChevronLeft />} />}

<HStack spacing="5">
{projects.map((_, i) => (
<Text
key={i}
onClick={() => setIndex(i)}
cursor="pointer"
color={i === index ? "primary.600" : "text.400"}
>
{i + 1}
</Text>
))}
</HStack>

{index < projects.length - 1 && (
<IconButton variant="link" aria-label="Arrow right" icon={<IconChevronRight />} />
)}
</HStack>
</HStack>
)}
</VStack>
)
}
24 changes: 16 additions & 8 deletions apps/website/src/data/projects.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{
"name": "Semaphore Explorer",
"tagline": "Semaphore explorer for on-chain groups.",
"tags": ["Tag", "Tag", "Tag"],
"tags": ["Data", "Development"],
"pse": true,
"icon": "",
"links": {
"website": "https://community.semaphore.pse.dev/semaphore-explorer",
Expand All @@ -13,7 +14,8 @@
{
"name": "Semaphore Discord Bot",
"tagline": "A Discord Bot for Semaphore",
"tags": ["Tag", "Tag", "Tag"],
"tags": ["Development"],
"pse": true,
"icon": "",
"links": {
"website": "https://discord.com/api/oauth2/authorize?client_id=1082429985496772628&permissions=1024&scope=bot",
Expand All @@ -24,7 +26,8 @@
{
"name": "Unirep",
"tagline": "Private and nonrepudiable reputation system based on ZKP.",
"tags": ["Tag", "Tag", "Tag"],
"tags": ["Reputation", "Identity", "Social"],
"pse": true,
"icon": "",
"links": {
"website": "https://developer.unirep.io",
Expand All @@ -35,7 +38,8 @@
{
"name": "Plurality",
"tagline": "An Identity Lego Building Block for DApp creators that lets them identify their users without using any third-party KYC provider or other middlemen, whilst preserving the privacy of users.",
"tags": ["Tag", "Tag", "Tag"],
"tags": ["Identity", "Trust"],
"pse": false,
"icon": "",
"links": {
"github": "https://github.com/Web3-Plurality"
Expand All @@ -44,7 +48,8 @@
{
"name": "ZK Proof of Humanity",
"tagline": "A project that allows humans, registered in Proof of Humanity, to prove their humanity without doxing.",
"tags": ["Tag", "Tag", "Tag"],
"tags": ["Identity", "Authenticity"],
"pse": false,
"icon": "",
"links": {
"website": "https://zk-proof-of-humanity.vercel.app",
Expand All @@ -54,7 +59,8 @@
{
"name": "ZeroTherapy",
"tagline": "AMA privacy application built with Semaphore.",
"tags": ["Tag", "Tag", "Tag"],
"tags": ["Voting", "Health"],
"pse": false,
"icon": "",
"links": {
"website": "https://zerotherapy.vercel.app",
Expand All @@ -64,7 +70,8 @@
{
"name": "Block Qualified",
"tagline": "On-chain and privacy preserving education platform built on Semaphore.",
"tags": ["Tag", "Tag", "Tag"],
"tags": ["Education"],
"pse": false,
"icon": "",
"links": {
"website": "https://bq2.netlify.app/",
Expand All @@ -74,7 +81,8 @@
{
"name": "StealthComms",
"tagline": "A project that allows users to prove their membership in a group and send messages/signals without revealing their original identity.",
"tags": ["Tag", "Tag", "Tag"],
"tags": ["Messaging"],
"pse": false,
"icon": "",
"links": {
"website": "https://stealthcomms.surge.sh/",
Expand Down
13 changes: 13 additions & 0 deletions apps/website/src/icons/IconChevronLeft.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Icon, IconProps } from "@chakra-ui/react"
import React from "react"

export default function IconChevronLeft(props: IconProps): JSX.Element {
return (
<Icon viewBox="0 0 8 14" {...props}>
<path
d="M2.828 6.99999L7.778 11.95L6.364 13.364L0 6.99999L6.364 0.635986L7.778 2.04999L2.828 6.99999Z"
fill="currentColor"
/>
</Icon>
)
}
14 changes: 9 additions & 5 deletions apps/website/src/styles/components/Button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const Button = {
boxShadow: "none"
},
borderRadius: "100px",
fontFamily: font.style.fontFamily
fontFamily: font.style.fontFamily,
fontWeight: "400",
paddingLeft: "18px !important",
paddingRight: "18px !important"
},
defaultProps: {
colorScheme: "white"
Expand All @@ -17,19 +20,20 @@ const Button = {
const { colorScheme: c } = props

if (c === "primary") {
const bg = "linear(to-r, primary.500, primary.800)"
// const bgGradient = "linear(to-r, primary.500, primary.800)"
const bg = `${c}.500`
const color = "white"

return {
bgGradient: bg,
bg,
color,
_hover: {
bg: "ceruleanBlue",
bg: `${c}.800`,
_disabled: {
bg
}
},
_active: { bg: `${c}.700` }
_active: { bg: `${c}.800` }
}
}

Expand Down
Loading

0 comments on commit 90a08c6

Please sign in to comment.