Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 explorer #1330

Merged
merged 148 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
e1742f5
feat: add header
dominik-stumpf Jun 27, 2024
037a8df
Merge branch 'shadcn-ui' of github.com:guildxyz/guild.xyz into v2-header
dominik-stumpf Jun 27, 2024
f369ad1
Merge branch 'shadcn-ui' of github.com:guildxyz/guild.xyz into v2-header
dominik-stumpf Jun 27, 2024
e39c633
chore: configure navigator
dominik-stumpf Jun 27, 2024
06f2b6f
feat: `Providers` component
BrickheadJohnny Jun 27, 2024
2c17947
chore: disable navigator on blur
dominik-stumpf Jun 27, 2024
beba2f0
Merge branch 'v2-header' of github.com:agoraxyz/guild.xyz into v2-header
BrickheadJohnny Jun 27, 2024
5550161
feat: `NavigationEvents` component
BrickheadJohnny Jun 27, 2024
f1a9543
feat: add explorer
dominik-stumpf Jun 27, 2024
d1c385b
refactor: make providers work with both routers
BrickheadJohnny Jun 27, 2024
f8533f7
chore: color corrections
dominik-stumpf Jun 27, 2024
83df470
feat: add dynamic header
dominik-stumpf Jun 27, 2024
a821a31
feat: add dynamic color to nav toggle
dominik-stumpf Jun 27, 2024
7cd04b4
feat: add robots, manifest, ring
dominik-stumpf Jun 27, 2024
19d13d6
chore: add display font to title
dominik-stumpf Jun 27, 2024
33f6017
chore: change ring color
dominik-stumpf Jun 28, 2024
c1b0a72
refactor: extract guild listing
dominik-stumpf Jun 28, 2024
39151ce
feat: make header and background responsive
dominik-stumpf Jun 28, 2024
3a1debe
Merge branch 'v2-header' of github.com:guildxyz/guild.xyz into v2-exp…
dominik-stumpf Jun 28, 2024
67dd7e9
feat: implement infinite scroll
dominik-stumpf Jun 28, 2024
9dadc26
feat: add loading spinner
dominik-stumpf Jun 28, 2024
0b3a2d6
feat: hook in searchbar
dominik-stumpf Jun 28, 2024
9444431
feat: add IntercomProvider
BrickheadJohnny Jun 28, 2024
c922373
feat: usePrevious hook
BrickheadJohnny Jun 28, 2024
ef7e7df
feat(CardMotionWrapper): use `m.div` instead of `MotionBox`
BrickheadJohnny Jun 28, 2024
b9e8583
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jun 28, 2024
30c9faa
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jun 28, 2024
777527b
wip: WalletSelectorModal without Google login button
BrickheadJohnny Jun 28, 2024
fc886b6
update package-lock
BrickheadJohnny Jun 28, 2024
d552881
feat: add anchor to search filter
dominik-stumpf Jun 28, 2024
65fb96d
feat: add link to card
dominik-stumpf Jun 28, 2024
caa4846
feat: add no search result message
dominik-stumpf Jun 28, 2024
fb353e6
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jun 29, 2024
9a94c1c
fix: proper button states in wallet selector modal
BrickheadJohnny Jun 29, 2024
8fab7a6
feat: `NavMenu` as popover
BrickheadJohnny Jun 30, 2024
28e9148
feat: `CopyableAddress` component
BrickheadJohnny Jul 1, 2024
737b4e3
fix(useGuild): use the new `usePathname` hook
BrickheadJohnny Jul 1, 2024
1c3a148
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jul 1, 2024
e27f5ad
fix: export `connectorButtonBaseProps` from `ConnectorButton`
BrickheadJohnny Jul 1, 2024
56c236f
refactor toast related css variables
BrickheadJohnny Jul 1, 2024
2ee463c
fix: replace relevant toasts with our new toast component
BrickheadJohnny Jul 1, 2024
0219192
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jul 1, 2024
6e39fa7
chore: upgrade nextjs
BrickheadJohnny Jul 1, 2024
7deb36d
wip: account modal
BrickheadJohnny Jul 1, 2024
442b7b0
chore: merge shadcn-ui branch
dominik-stumpf Jul 1, 2024
1d4733c
ci: ignore waas import errors
dominik-stumpf Jul 1, 2024
073d903
fix: addess merge conflict on toolbar, type errors
dominik-stumpf Jul 1, 2024
d6430ab
chore: add debounce instead of defer
dominik-stumpf Jul 1, 2024
8de8c82
chore: merge shadcn-ui branch
dominik-stumpf Jul 1, 2024
8117d92
chore: merge v2-header branch
dominik-stumpf Jul 1, 2024
8fe410f
chore: fix constant imports
dominik-stumpf Jul 1, 2024
67e30e1
feat: make guild card image cacheable
dominik-stumpf Jul 1, 2024
f7f0470
feat: add anchor
dominik-stumpf Jul 1, 2024
e487670
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jul 2, 2024
8502a6a
cleanup playground
BrickheadJohnny Jul 2, 2024
047bb76
refactor posthog, intercom, web3 related contexts & hooks
BrickheadJohnny Jul 2, 2024
d06a9e7
cleanup: remove `DialogExample`
BrickheadJohnny Jul 2, 2024
253203c
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jul 2, 2024
29e2cc1
fix(CardMotionWrapper): remove the `EASING` import
BrickheadJohnny Jul 2, 2024
e376372
Merge remote-tracking branch 'origin' into v2-header
dominik-stumpf Jul 3, 2024
2c1d482
chore: merge shadcn-ui branch
dominik-stumpf Jul 3, 2024
d9e797c
Try fix build "out of memory" error (#1347)
dominik-stumpf Jul 3, 2024
bd36ad8
feat(CopyableAddress): add tooltip
BrickheadJohnny Jul 3, 2024
5b1c1a6
feat: `NetworkModal` migration
BrickheadJohnny Jul 3, 2024
610278a
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jul 3, 2024
1864793
feat: `Accordion` component
BrickheadJohnny Jul 4, 2024
be3e975
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jul 4, 2024
ee7980c
temporarily remove `CircularDependencyPlugin`
BrickheadJohnny Jul 4, 2024
20adadc
move `platformMergeAlertAtom` to `atoms.ts`
BrickheadJohnny Jul 4, 2024
29127bf
fix(useUserPublic): comment posthog related stuff
BrickheadJohnny Jul 4, 2024
c4fb686
chore: merge main branch
dominik-stumpf Jul 4, 2024
9286d9d
Merge branch 'main' of github.com:guildxyz/guild.xyz into v2-explorer
dominik-stumpf Jul 4, 2024
e54cef0
chore: merge shadcn-ui branch
dominik-stumpf Jul 4, 2024
d0b8add
chore: merge v2-header branch
dominik-stumpf Jul 4, 2024
bb2208d
chore: remove package-json
dominik-stumpf Jul 4, 2024
b6a4d30
feat: `FarcasterProfile` component
BrickheadJohnny Jul 5, 2024
0a796a3
fix ring color in light mode
BrickheadJohnny Jul 5, 2024
5051463
fix: remove ring offset
BrickheadJohnny Jul 5, 2024
f4b634a
fix: connect Farcaster button colors
BrickheadJohnny Jul 5, 2024
0fae2e1
feat: define css vars for every platform type
BrickheadJohnny Jul 5, 2024
dc996fb
fix(SocialAccount): use the correct button colors
BrickheadJohnny Jul 5, 2024
af16be3
chore: merge v2-header branch
dominik-stumpf Jul 5, 2024
68a21a6
Merge branch 'shadcn-ui' into v2-header
BrickheadJohnny Jul 5, 2024
778ffd9
chore: merge v2-header branch
dominik-stumpf Jul 6, 2024
2818dcb
fix: solve css overlay
dominik-stumpf Jul 6, 2024
39e2d9f
feat: add anchor element to page
dominik-stumpf Jul 6, 2024
77b78b7
feat: add layout, search refactor
dominik-stumpf Jul 6, 2024
5becc9e
refactor: extract query atom
dominik-stumpf Jul 6, 2024
619a1ee
feat: add your guilds
dominik-stumpf Jul 6, 2024
8418b4d
fix(build): add missing dep
dominik-stumpf Jul 8, 2024
8577e1a
fix(build): add suspense boundary, auth check
dominik-stumpf Jul 8, 2024
d3e85e6
fix(build): move out suspense boundary
dominik-stumpf Jul 8, 2024
dd37d8b
fix(a11y): add padding to verified badge, extract signin button
dominik-stumpf Jul 8, 2024
72c0d0b
chore: merge shadcn-ui branch
dominik-stumpf Jul 8, 2024
7810be8
refactor: move layout into one file
dominik-stumpf Jul 9, 2024
d0fa7ed
chore!: delete changes
dominik-stumpf Jul 10, 2024
872ec3d
chore: merge shadcn-ui branch
dominik-stumpf Jul 10, 2024
16c7a2c
style: apply biome check
dominik-stumpf Jul 10, 2024
e61620b
chore: add hooks
dominik-stumpf Jul 10, 2024
de54a67
chore: merge playground
dominik-stumpf Jul 10, 2024
900718f
chore: merge shadcn-ui branch
dominik-stumpf Jul 10, 2024
77e8551
chore: pull useIsStuck
dominik-stumpf Jul 10, 2024
8e1d8bf
chore: remove conflicting explorer page
dominik-stumpf Jul 10, 2024
35575c9
chore: fix ts errors
dominik-stumpf Jul 10, 2024
99ec94d
chore: pull UserGuildPins
dominik-stumpf Jul 10, 2024
c041b27
chore: update account inside layout
dominik-stumpf Jul 10, 2024
9ed6200
Merge branch 'shadcn-ui' into v2-explorer
BrickheadJohnny Jul 11, 2024
b286c0a
Merge branch 'shadcn-ui' into v2-explorer
BrickheadJohnny Jul 11, 2024
021dc1d
fix(GuildCard): styling
BrickheadJohnny Jul 11, 2024
548fea7
fix(GuildSearchBar): fine-tune styles
BrickheadJohnny Jul 11, 2024
2ad30be
fix(explorer): small refactor & styling improvements
BrickheadJohnny Jul 11, 2024
d4fdd34
refactor(explorer): prefetch guilds on the server
BrickheadJohnny Jul 11, 2024
468ee90
fix: use the default phosphor icons
BrickheadJohnny Jul 11, 2024
7d168b9
Revert "fix: use the default phosphor icons"
BrickheadJohnny Jul 11, 2024
ddc9b5a
fix(GuildInfiniteScroll): use the `useFetcherWithSign` hook
BrickheadJohnny Jul 11, 2024
42f2467
fix(WalletSelectorModal): highlighted "learn more" link
BrickheadJohnny Jul 11, 2024
bfb3a45
feat(StickyBar): add smooth scroll
BrickheadJohnny Jul 11, 2024
55e5f94
fix(Toggle): default variant - `state=on` style
BrickheadJohnny Jul 11, 2024
07f9e6e
chore: add aria label to wcm modal
dominik-stumpf Jul 11, 2024
cdaa5d2
chore: move setAttribute
dominik-stumpf Jul 11, 2024
7860d18
Merge branch 'shadcn-ui' of github.com:guildxyz/guild.xyz into v2-exp…
dominik-stumpf Jul 11, 2024
e66c01d
chore: remove robots.txt duplicate, add new layout
dominik-stumpf Jul 11, 2024
1024e42
fix(a11y): adjust colors to metrics
dominik-stumpf Jul 11, 2024
553066c
fix: offset and color banner properly
dominik-stumpf Jul 11, 2024
671cf28
Merge branch 'shadcn-ui' of github.com:guildxyz/guild.xyz into v2-exp…
dominik-stumpf Jul 11, 2024
6021f33
chore: make button semibold
dominik-stumpf Jul 11, 2024
46cf099
chore: fix robots.txt
dominik-stumpf Jul 11, 2024
01393d9
Revert "chore: fix robots.txt"
dominik-stumpf Jul 11, 2024
0cc585e
chore: remove unused explorer-related components
BrickheadJohnny Jul 12, 2024
9344118
fix(GuildSearchBar): increase debounce time
BrickheadJohnny Jul 12, 2024
7c8a287
fix(HeaderBackground): background height on mobile
BrickheadJohnny Jul 12, 2024
2efcbb3
fix(Explorer): only show the "Your guilds" section if the user has a …
BrickheadJohnny Jul 12, 2024
b291c44
fix(StickyBar): add `/create-guild` link
BrickheadJohnny Jul 12, 2024
c857299
fix(GuildSearchBar): add smooth scroll
BrickheadJohnny Jul 12, 2024
e88068d
cleanup(YourGuilds): use the already existing hook
BrickheadJohnny Jul 12, 2024
2b63f14
fix(explore): spacings & scroll animation
BrickheadJohnny Jul 12, 2024
3d1046d
cleanup(GuildSearchBar): remove comment
BrickheadJohnny Jul 12, 2024
7a36e7f
feat(explorer): prefetch top newest guilds too
BrickheadJohnny Jul 12, 2024
d5b9225
refactor: store query state in the URL
BrickheadJohnny Jul 12, 2024
b552160
cleanup: remove unused `PageBoundary` file
BrickheadJohnny Jul 12, 2024
6ebb0b6
fix: change observerTarget's aria-label
BrickheadJohnny Jul 12, 2024
64cc409
cleanup(Web3ConnectionManager): remove unused import
BrickheadJohnny Jul 12, 2024
5ca8cd4
cleanup(explorer): footer copy
BrickheadJohnny Jul 12, 2024
7c56133
fix(Explorer): wrap `GuildInfiniteScroll` in `Suspense`
BrickheadJohnny Jul 12, 2024
d08774c
refactor: pass search params down from the explorer page
BrickheadJohnny Jul 12, 2024
5837868
fix(GuildSearchBar): remove buggy useEffect
BrickheadJohnny Jul 12, 2024
00530ad
chore: load images better
dominik-stumpf Jul 12, 2024
3e2862d
Merge branch 'v2-explorer' of github.com:guildxyz/guild.xyz into v2-e…
dominik-stumpf Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ cypress/screenshots
cypress/videos

.idea

*.tsbuildinfo

*storybook.log
storybook-static
storybook-static
115 changes: 115 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions src/app/explorer/_components/Explorer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use client"

import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { Button } from "@/components/ui/Button"
import { Card } from "@/components/ui/Card"
import { useUserPublic } from "@/hooks/useUserPublic"
import { SignIn } from "@phosphor-icons/react"
import { GuildSearchBar } from "app/explorer/_components/GuildSearchBar"
import { YourGuilds } from "app/explorer/_components/YourGuilds"
import useIsStuck from "hooks/useIsStuck"
import { useSetAtom } from "jotai"
import { Suspense } from "react"
import { SearchParams } from "types"
import Robot from "/public/landing/robot.svg"
import { isSearchStuckAtom } from "../atoms"
import { ActiveSection } from "../types"
import { GuildInfiniteScroll } from "./GuildInfiniteScroll"
import { StickyBar } from "./StickyBar"

export const Explorer = ({ searchParams }: { searchParams: SearchParams }) => {
const { keyPair } = useUserPublic()
const setIsSearchStuck = useSetAtom(isSearchStuckAtom)
const setIsWalletSelectorModalOpen = useSetAtom(walletSelectorModalAtom)

const { ref: searchRef } = useIsStuck(setIsSearchStuck)

return (
<>
<StickyBar />

{!!keyPair ? (
<YourGuilds />
) : (
<Card className="mt-2 mb-8 flex flex-col items-stretch justify-between gap-8 p-6 font-semibold sm:flex-row sm:items-center">
<div className="flex items-center gap-4">
<Robot className="size-8 min-w-8 text-white" />
<span>Sign in to view your guilds / create new ones</span>
</div>
<Button
className="space-x-2"
onClick={() => setIsWalletSelectorModalOpen(true)}
>
<SignIn />
<span className="text-md">Sign in</span>
</Button>
</Card>
)}

<section id={ActiveSection.ExploreGuilds} className="flex flex-col gap-5">
<h2 className="font-bold text-lg tracking-tight">Explore verified guilds</h2>
<div className="sticky top-12 z-10" ref={searchRef}>
<Suspense>
<GuildSearchBar />
</Suspense>
</div>

<GuildInfiniteScroll searchParams={searchParams} />
</section>
</>
)
}
11 changes: 11 additions & 0 deletions src/app/explorer/_components/ExplorerSWRProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use client"

import { PropsWithChildren } from "react"
import { SWRConfig, type SWRConfiguration } from "swr"

export const ExplorerSWRProvider = ({
children,
value,
}: PropsWithChildren<{ value: SWRConfiguration }>) => {
return <SWRConfig value={value}>{children}</SWRConfig>
}
103 changes: 103 additions & 0 deletions src/app/explorer/_components/GuildInfiniteScroll.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
"use client"

import { GuildCardSkeleton, GuildCardWithLink } from "@/components/GuildCard"
import { Spinner } from "@phosphor-icons/react"
import useUser from "components/[guild]/hooks/useUser"
import { env } from "env"
import { useFetcherWithSign } from "hooks/useFetcherWithSign"
import { useScrollBatchedRendering } from "hooks/useScrollBatchedRendering"
import { memo, useRef } from "react"
import { SWRConfiguration } from "swr"
import useSWRInfinite from "swr/infinite"
import { GuildBase, SearchParams } from "types"

const BATCH_SIZE = 24

const GuildCardMemo = memo(GuildCardWithLink)

const GuildCards = ({ guildData }: { guildData?: GuildBase[] }) => {
if (guildData?.length) {
return guildData.map((data) => <GuildCardMemo key={data.id} guildData={data} />)
}
return Array.from({ length: BATCH_SIZE }, (_, i) => <GuildCardSkeleton key={i} />)
}

const useExploreGuilds = (searchParams?: SearchParams) => {
const { isSuperAdmin } = useUser()
const fetcherWithSign = useFetcherWithSign()
const options: SWRConfiguration = {
dedupingInterval: 60_000,
}

// sending authed request for superAdmins, so they can see unverified & hideFromExplorer guilds too
// @ts-expect-error TODO: resolve this type error
return useSWRInfinite<GuildBase[]>(
(pageIndex, previousPageData) => {
if (Array.isArray(previousPageData) && previousPageData.length !== BATCH_SIZE)
return null
const url = new URL("/v2/guilds", env.NEXT_PUBLIC_API)
const params: Record<string, string> = {
order: "FEATURED",
...searchParams,
offset: (BATCH_SIZE * pageIndex).toString(),
limit: BATCH_SIZE.toString(),
}
for (const entry of Object.entries(params)) {
url.searchParams.set(...entry)
}

const urlString = url.pathname + url.search
if (isSuperAdmin) return [urlString, { method: "GET", body: {} }]
return urlString
},
isSuperAdmin ? fetcherWithSign : options,
isSuperAdmin ? options : null
)
}

export const GuildInfiniteScroll = ({
searchParams,
}: { searchParams: SearchParams }) => {
const search = searchParams.search
const ref = useRef<HTMLElement>(null)
const {
data: filteredGuilds,
setSize,
isValidating,
isLoading,
} = useExploreGuilds(searchParams)
const renderedGuilds = filteredGuilds?.flat()

useScrollBatchedRendering({
batchSize: 1,
scrollTarget: ref,
disableRendering: isValidating,
setElementCount: setSize,
offsetPixel: 420,
})

if (!renderedGuilds?.length && !isLoading) {
if (!isValidating && !search?.length) {
return (
<div>Can't fetch guilds from the backend right now. Check back later!</div>
)
} else {
return <div>{`No results for ${search}`}</div>
}
}

return (
<>
<section
className="grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3"
ref={ref}
>
<GuildCards guildData={renderedGuilds} />
</section>
<Spinner
className="invisible mx-auto size-8 animate-spin data-[active=true]:visible"
data-active={isValidating || isLoading}
/>
</>
)
}
Loading
Loading