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

phosphor icons experiments #1386

Closed
wants to merge 68 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
4eb63e7
install/upgrade dependencies & configure shadcn/ui
BrickheadJohnny Jun 27, 2024
f2e1010
use ts for tailwind config
BrickheadJohnny Jun 27, 2024
71a186f
add basic `layout.tsx`
BrickheadJohnny Jun 27, 2024
88fae3b
fix: remove top-level `/app` folder & add playground page
BrickheadJohnny Jun 27, 2024
fc83d9c
v2 add next theme (#1325)
dominik-stumpf Jun 27, 2024
d474773
feat: `Card` component (#1326)
BrickheadJohnny Jun 27, 2024
8d024c8
feat: `Dialog` component (#1328)
BrickheadJohnny Jun 27, 2024
a32ceb6
add shadcn button and style adjustments (#1327)
dominik-stumpf Jun 27, 2024
3a9323c
build: revert sourcing on postinstall
dominik-stumpf Jun 27, 2024
c69176d
fix(DialogExample): add `asChild` prop to trigger
BrickheadJohnny Jun 27, 2024
ea661c7
feat(Dialog): add focus management props
BrickheadJohnny Jun 28, 2024
156b4d2
feat(Dialog): export `DialogCloseButton` component
BrickheadJohnny Jun 28, 2024
46f8618
fix: update `--muted-foreground` variable
BrickheadJohnny Jun 29, 2024
7edc914
fix(ThemeToggle): make the buttons smaller
BrickheadJohnny Jun 29, 2024
d8d321d
Storybook (#1332)
BrickheadJohnny Jun 29, 2024
f6694f4
feat: add tooltip (#1335)
dominik-stumpf Jul 1, 2024
0a923e6
feat: `Toast` component & `useToast` hook (#1333)
BrickheadJohnny Jul 1, 2024
544146d
feat: `AlertDialog` component (#1337)
BrickheadJohnny Jul 1, 2024
773c2f7
Merge remote-tracking branch 'origin' into shadcn-ui
dominik-stumpf Jul 1, 2024
7a54835
Merge branch 'main' into shadcn-ui
BrickheadJohnny Jul 2, 2024
5ae1590
Merge branch 'main' into shadcn-ui
BrickheadJohnny Jul 2, 2024
e837fff
`Dialog` improvements (#1351)
BrickheadJohnny Jul 3, 2024
0e6572a
Merge branch 'main' into shadcn-ui
BrickheadJohnny Jul 4, 2024
e9635f8
fix(AlertDialog.stories): import types only
BrickheadJohnny Jul 4, 2024
64ac97b
fix(useToast): eslint issue
BrickheadJohnny Jul 4, 2024
da54c40
feat: `Form` component (#1358)
BrickheadJohnny Jul 5, 2024
25c0d32
feat: `Badge` component
BrickheadJohnny Jul 8, 2024
b1bf522
feat: `DropdownMenu` component (#1359)
BrickheadJohnny Jul 8, 2024
a525c4b
Merge branch 'main' into shadcn-ui
BrickheadJohnny Jul 9, 2024
a400f6d
chore: change default theme to dark
dominik-stumpf Jul 9, 2024
163c8a9
Merge branch 'main' into shadcn-ui
BrickheadJohnny Jul 10, 2024
08601ab
Merge branch 'main' into shadcn-ui
BrickheadJohnny Jul 10, 2024
39fdd57
feat: add anchor component (#1362)
dominik-stumpf Jul 10, 2024
399161c
chore: merge main branch
dominik-stumpf Jul 10, 2024
c26854d
style: apply biome check
dominik-stumpf Jul 10, 2024
0d79c4b
feat: add header (#1329)
dominik-stumpf Jul 10, 2024
406b992
Merge branch 'main' of github.com:guildxyz/guild.xyz into shadcn-ui
dominik-stumpf Jul 10, 2024
fa8b9dc
style: apply biome check
dominik-stumpf Jul 10, 2024
870188b
feat: add avatar and separator
dominik-stumpf Jul 10, 2024
aa75541
chore: update team href
dominik-stumpf Jul 10, 2024
626b754
Merge branch 'main' into shadcn-ui
BrickheadJohnny Jul 11, 2024
7edde79
fix: ring colors
BrickheadJohnny Jul 11, 2024
4cf228c
fix(CardMotionWrapper): add easing functions
BrickheadJohnny Jul 11, 2024
e0d19dd
fix(Dialog): ring color
BrickheadJohnny Jul 11, 2024
10ef137
fix: fine-tune accent & border colors
BrickheadJohnny Jul 11, 2024
8b4b437
fix(SharedSocials): UI improvements
BrickheadJohnny Jul 11, 2024
d6e4fc5
fix(ThemeToggle): make it work in both pages & app router
BrickheadJohnny Jul 11, 2024
c6e62e3
fix: minor UI issues
BrickheadJohnny Jul 11, 2024
3aa6e44
fix(ConnectRequirementPlatformButton): use the new `Button` component
BrickheadJohnny Jul 11, 2024
4baf3fa
fix(RequirementConnectButton): accept `ButtonProps`
BrickheadJohnny Jul 11, 2024
7470a91
feat: add notifications (#1360)
dominik-stumpf Jul 11, 2024
3cc3cdc
feat: add compound layout component (#1363)
dominik-stumpf Jul 11, 2024
1260a27
fix(NavMenu): add create-guild
dovalid Jul 11, 2024
fcaba43
UI(NavMenu): whitespace impros, highlight current path
dovalid Jul 11, 2024
afa804e
fix(NavMenu): use the `usePathname` hook
BrickheadJohnny Jul 12, 2024
2aecad4
fix(ThemeToggle): remove `console.log`
BrickheadJohnny Jul 12, 2024
b9e602d
v2 explorer (#1330)
dominik-stumpf Jul 12, 2024
efca6a1
UI(Dialog): mobile style
dovalid Jul 12, 2024
19256a6
Merge branch 'main' of github.com:guildxyz/guild.xyz into shadcn-ui
dominik-stumpf Jul 12, 2024
3bee065
fix(css): darken dark mode skeleton color (#1379)
dominik-stumpf Jul 13, 2024
638a502
chore: delete linux related esbuild plugin (#1380)
dominik-stumpf Jul 13, 2024
0b114cc
notification fix and cleanup (#1377)
dominik-stumpf Jul 13, 2024
821b6f0
fix(layout): add `antialiased` class
BrickheadJohnny Jul 15, 2024
7b85870
fix(Dialog): close animation
BrickheadJohnny Jul 15, 2024
500f833
chore: import types & context from `/dist/lib/...`
BrickheadJohnny Jul 15, 2024
9697adb
chore: remove `* as React` imports
BrickheadJohnny Jul 15, 2024
e272944
Merge branch 'shadcn-ui' into phosphor-icons-experiments
BrickheadJohnny Jul 15, 2024
ebfa1d2
feat: add `usedExports: true` to webpack config
BrickheadJohnny Jul 15, 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
Prev Previous commit
Next Next commit
v2 explorer (#1330)
* feat: add header

* chore: configure navigator

* feat: `Providers` component

* chore: disable navigator on blur

* feat: `NavigationEvents` component

* feat: add explorer

* refactor: make providers work with both routers

* chore: color corrections

* feat: add dynamic header

* feat: add dynamic color to nav toggle

* feat: add robots, manifest, ring

* chore: add display font to title

* chore: change ring color

* refactor: extract guild listing

* feat: make header and background responsive

* feat: implement infinite scroll

* feat: add loading spinner

* feat: hook in searchbar

* feat: add IntercomProvider

* feat: usePrevious hook

* feat(CardMotionWrapper): use `m.div` instead of `MotionBox`

* wip: WalletSelectorModal without Google login button

* update package-lock

* feat: add anchor to search filter

* feat: add link to card

* feat: add no search result message

* fix: proper button states in wallet selector modal

* feat: `NavMenu` as popover

* feat: `CopyableAddress` component

* fix(useGuild): use the new `usePathname` hook

* fix: export `connectorButtonBaseProps` from `ConnectorButton`

* refactor toast related css variables

* fix: replace relevant toasts with our new toast component

* chore: upgrade nextjs

* wip: account modal

* ci: ignore waas import errors

* fix: addess merge conflict on toolbar, type errors

* chore: add debounce instead of defer

* chore: fix constant imports

* feat: make guild card image cacheable

* feat: add anchor

* cleanup playground

* refactor posthog, intercom, web3 related contexts & hooks

* cleanup: remove `DialogExample`

* fix(CardMotionWrapper): remove the `EASING` import

* Try fix build "out of memory" error (#1347)

* build: allocate more memory for nodejs on build

* build: increase memory limit

* chore: remove posthog provider to test build error

* chore: remove posthog provider to test build error

* chore: remove reward import

* build: remove memory limit override

* chore: fix circular import

* fix: update import outside v2

* fix: add missing react suspense

* Revert "chore: remove reward import"

This reverts commit b2cf1d8.

* chore: remove accidental svg

* fix(layout): add back `PostHogPageViews`

---------

Co-authored-by: BrickheadJohnny <johnny.zgen@gmail.com>

* feat(CopyableAddress): add tooltip

* feat: `NetworkModal` migration

* feat: `Accordion` component

* temporarily remove `CircularDependencyPlugin`

* move `platformMergeAlertAtom` to `atoms.ts`

* fix(useUserPublic): comment posthog related stuff

* chore: remove package-json

* feat: `FarcasterProfile` component

* fix ring color in light mode

* fix: remove ring offset

* fix: connect Farcaster button colors

* feat: define css vars for every platform type

* fix(SocialAccount): use the correct button colors

* fix: solve css overlay

* feat: add anchor element to page

* feat: add layout, search refactor

* refactor: extract query atom

* feat: add your guilds

* fix(build): add missing dep

* fix(build): add suspense boundary, auth check

* fix(build): move out suspense boundary

* fix(a11y): add padding to verified badge, extract signin button

* refactor: move layout into one file

* chore!: delete changes

* style: apply biome check

* chore: add hooks

* chore: merge playground

* chore: pull useIsStuck

* chore: remove conflicting explorer page

* chore: fix ts errors

* chore: pull UserGuildPins

* chore: update account inside layout

* fix(GuildCard): styling

* fix(GuildSearchBar): fine-tune styles

* fix(explorer): small refactor & styling improvements

* refactor(explorer): prefetch guilds on the server

* fix: use the default phosphor icons

* Revert "fix: use the default phosphor icons"

This reverts commit 468ee90.

* fix(GuildInfiniteScroll): use the `useFetcherWithSign` hook

* fix(WalletSelectorModal): highlighted "learn more" link

* feat(StickyBar): add smooth scroll

* fix(Toggle): default variant - `state=on` style

* chore: add aria label to wcm modal

* chore: move setAttribute

* chore: remove robots.txt duplicate, add new layout

* fix(a11y): adjust colors to metrics

* fix: offset and color banner properly

* chore: make button semibold

* chore: fix robots.txt

* Revert "chore: fix robots.txt"

This reverts commit 46cf099.

* chore: remove unused explorer-related components

* fix(GuildSearchBar): increase debounce time

* fix(HeaderBackground): background height on mobile

* fix(Explorer): only show the "Your guilds" section if the user has a keypair

* fix(StickyBar): add `/create-guild` link

* fix(GuildSearchBar): add smooth scroll

* cleanup(YourGuilds): use the already existing hook

* fix(explore): spacings & scroll animation

* cleanup(GuildSearchBar): remove comment

* feat(explorer): prefetch top newest guilds too

* refactor: store query state in the URL

* cleanup: remove unused `PageBoundary` file

* fix: change observerTarget's aria-label

* cleanup(Web3ConnectionManager): remove unused import

* cleanup(explorer): footer copy

* fix(Explorer): wrap `GuildInfiniteScroll` in `Suspense`

* refactor: pass search params down from the explorer page

* fix(GuildSearchBar): remove buggy useEffect

* chore: load images better

---------

Co-authored-by: BrickheadJohnny <johnny.zgen@gmail.com>
  • Loading branch information
dominik-stumpf and BrickheadJohnny authored Jul 12, 2024
commit b9e602d253b9233e58d50113e77c2c0516a5da3d
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