-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐡🪐 ↝ Updated styling for Lens client (basic css for now) & added dyna…
…mic routes for profile loading Signal-K/Silfur#24 & #16
- Loading branch information
1 parent
b84a27c
commit 7818816
Showing
12 changed files
with
323 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { MediaRenderer } from '@thirdweb-dev/react'; | ||
import Link from 'next/link'; | ||
import React from 'react'; | ||
import { ExplorePublicationsQuery } from '../graphql/generated'; | ||
import styles from '../styles/FeedPost.module.css'; | ||
|
||
type Props = { | ||
publication: ExplorePublicationsQuery["explorePublications"]["items"][0]; | ||
} | ||
|
||
export default function FeedPost ({publication}: Props) { | ||
return ( | ||
<div className={styles.feedPostContainer}> | ||
<div className={styles.feedPostHeader}> | ||
<MediaRenderer | ||
// @ts-ignore | ||
src={publication?.profile?.picture?.original?.url} | ||
alt={publication.profile.name || publication.profile.handle} | ||
className={styles.feedPostProfilePicture} | ||
/> | ||
<Link href={`/profile/${publication.profile.handle}`} className={styles.feedPostProfileName}> | ||
{publication.profile.name || publication.profile.handle} | ||
</Link> | ||
</div> | ||
<div className={styles.feedPostContent}> | ||
<h3 className={styles.feedPostContentTitle}>{publication.metadata.name}</h3> | ||
<p className={styles.feedPostContentDescription}>{publication.metadata.content}</p> | ||
|
||
{ publication.metadata.media?.length > 0 && ( | ||
<MediaRenderer | ||
src={publication.metadata.media[0].original.url} | ||
alt={publication.metadata.name || ""} | ||
className={styles.feedPostContentImage} | ||
/> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query profile($request: SingleProfileQueryRequest!) { | ||
profile(request: $request) { | ||
...ProfileFields | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
query publications($request: PublicationsQueryRequest!) { | ||
publications(request: $request) { | ||
items { | ||
__typename | ||
... on Post { | ||
...PostFields | ||
} | ||
... on Comment { | ||
...CommentFields | ||
} | ||
... on Mirror { | ||
...MirrorFields | ||
} | ||
} | ||
pageInfo { | ||
...CommonPaginatedResultInfoFields | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,34 @@ | ||
import type { NextPage } from "next"; | ||
import useAuthenticate from '../hooks/useAuthenticate'; | ||
import { useAddress, useDisconnect, useUser, useLogout, useMetamask, ConnectWallet } from "@thirdweb-dev/react"; | ||
import { useEffect, useState } from "react"; | ||
import { PublicationSortCriteria, useExplorePublicationsQuery } from "../graphql/generated"; | ||
import useLogin from "../lib/auth/useLogin"; | ||
import FeedPost from "../components/FeedPost"; | ||
import SignInButton from "../components/SignInButton"; | ||
import { PublicationSortCriteria, useExplorePublicationsQuery } from "../graphql/generated"; | ||
import styles from '../styles/Home.module.css'; | ||
|
||
export default function Home () { | ||
return <SignInButton />; | ||
const { isLoading, error, data } = useExplorePublicationsQuery({ | ||
request: { | ||
sortCriteria: PublicationSortCriteria.TopCollected, | ||
}, | ||
}, | ||
{ | ||
refetchOnWindowFocus: false, | ||
refetchOnReconnect: false, | ||
}); | ||
|
||
if (isLoading) { | ||
return (<div className={styles.container}>Loading</div>) | ||
}; | ||
|
||
if (error) { | ||
return (<div className={styles.container}>Error</div>) | ||
}; | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<div className={styles.postContainer}> | ||
{data?.explorePublications.items.map((publication) => ( | ||
<FeedPost publication={publication} key={publication.id} /> | ||
))}; | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useRouter } from 'next/router'; | ||
import React from 'react'; | ||
import { useProfileQuery, usePublicationsQuery } from '../../graphql/generated'; | ||
import styles from '../../styles/Profile.module.css'; | ||
|
||
type Props = {} | ||
|
||
export default function ProfilePage({}: Props) { | ||
const router = useRouter(); | ||
const { id } = router.query; | ||
const { isLoading: loadingProfile, data: profileData } = useProfileQuery({ | ||
request: { | ||
handle: id, | ||
}, | ||
}, { | ||
enabled: !!id, | ||
}); | ||
|
||
const { isLoading: isLoadingPublications, data: publicationsData } = usePublicationsQuery({ | ||
request: { | ||
profileId: profileData?.profile?.id | ||
}, | ||
}, { | ||
enabled: !!profileData?.profile?.id, | ||
}); | ||
|
||
return ( | ||
<div className={styles.profileContainer}> | ||
<div className={styles.profileContentContainer}> | ||
|
||
</div> | ||
<div className={styles.publicationsContainer}> | ||
|
||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.feedPostContainer { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: rgba(30, 30, 30, 0.9); | ||
border: 1px solid black; | ||
border-radius: 10px; | ||
padding: 16px; | ||
margin-bottom: 16px; | ||
width: 100%; | ||
gap: 16px; | ||
text-align: center; | ||
} | ||
|
||
.feedPostHeader { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: flex-start; | ||
gap: 12px; | ||
} | ||
|
||
.feedPostProfilePicture { | ||
border-radius: 50%; | ||
width: 48px; | ||
height: 48px; | ||
border: 1px solid black; | ||
} | ||
|
||
.feedPostProfileName { | ||
font-size: 16px; | ||
font-weight: 600; | ||
} | ||
|
||
.feedPostContentImage { | ||
height: 256px; | ||
} | ||
|
||
.feedPostContentTitle { | ||
font-size: 24px; | ||
font-weight: 600; | ||
} | ||
|
||
.feedPostContentDescription { | ||
font-size: 16px; | ||
font-weight: 400; | ||
} |
Oops, something went wrong.