-
Notifications
You must be signed in to change notification settings - Fork 16
feat(apps/ensadmin): show more social links on name page #1071
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ddf0f9c
docs(changeset): get social coin types for telegram, linkedin and reddit
notrab 8a82ff8
lint
notrab e69df34
Update .changeset/quick-doodles-read.md
notrab 0f8936a
remove changeset for ensnode-sdk
notrab 7ff5230
normalizeWebsiteUrl
notrab 655a736
workaround for extended selection text
notrab 0234807
lint
notrab f908066
Merge branch 'main' into profile-social-links
shrugs daa20d2
fix: import caps
shrugs 0bd29ba
refactor: social links to be more generic
shrugs 6f1e321
more websites to default record set
shrugs b7840aa
fix social link keys to match text key format
shrugs 996bd6a
fix: additional records naming
shrugs 37ae0ab
fix: update behavior and comments for SocialLink
shrugs a474282
add beautiful url and add keys to social links
shrugs b62714e
refactor: move components to private components folder
shrugs b4e9b16
fix: skeleton logic
shrugs 463a952
fix: remove comment
shrugs b1485b4
each app should define their own record selection
lightwalker-eth 9651b2a
lint
lightwalker-eth 8b51523
Add links to follow up issues
lightwalker-eth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| --- | ||
| "ensadmin": minor | ||
| --- | ||
|
|
||
| Add support for telegram, linkedin and reddit profiles on name detail page | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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 hidden or 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
File renamed without changes.
125 changes: 125 additions & 0 deletions
125
apps/ensadmin/src/app/name/[name]/_components/SocialLinks.tsx
This file contains hidden or 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,125 @@ | ||
| "use client"; | ||
|
|
||
| import { useMemo } from "react"; | ||
|
|
||
| import { ExternalLinkWithIcon } from "@/components/external-link-with-icon"; | ||
| import { LinkedInIcon } from "@/components/icons/LinkedInIcon"; | ||
| import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; | ||
| import { SiFarcaster, SiGithub, SiReddit, SiTelegram, SiX } from "@icons-pack/react-simple-icons"; | ||
|
|
||
| const SOCIAL_LINK_KEYS = [ | ||
| "com.twitter", | ||
| "com.farcaster", | ||
| "com.github", | ||
| "org.telegram", | ||
| "com.linkedin", | ||
| "com.reddit", | ||
| ] as const; | ||
|
|
||
| type SocialLinkKey = (typeof SOCIAL_LINK_KEYS)[number]; | ||
| type SocialLinkValue = string; | ||
|
|
||
| export function SocialLinks({ | ||
| links, | ||
| }: { links: { key: SocialLinkKey; value: SocialLinkValue }[] }) { | ||
| if (links.length === 0) return null; | ||
|
|
||
| return ( | ||
| <Card> | ||
| <CardHeader> | ||
| <CardTitle>Social Links</CardTitle> | ||
| </CardHeader> | ||
| <CardContent className="gap-3 flex flex-col md:flex-row flex-wrap"> | ||
| {links.map(({ key, value }) => { | ||
| switch (key) { | ||
| case "com.twitter": { | ||
| return ( | ||
| <div key={key} className="inline-flex items-center gap-2"> | ||
| <SiX size={16} className="text-gray-500" /> | ||
| <ExternalLinkWithIcon href={`https://twitter.com/${value}`} className="text-sm"> | ||
| @{value} | ||
| </ExternalLinkWithIcon> | ||
| </div> | ||
| ); | ||
| } | ||
| case "com.github": { | ||
| return ( | ||
| <div key={key} className="inline-flex items-center gap-2"> | ||
| <SiGithub size={16} className="text-gray-500" /> | ||
| <ExternalLinkWithIcon href={`https://github.com/${value}`} className="text-sm"> | ||
| {value} | ||
| </ExternalLinkWithIcon> | ||
| </div> | ||
| ); | ||
| } | ||
| case "com.farcaster": { | ||
| return ( | ||
| <div key={key} className="inline-flex items-center gap-2"> | ||
| <SiFarcaster size={16} className="text-gray-500" /> | ||
| <ExternalLinkWithIcon href={`https://warpcast.com/${value}`} className="text-sm"> | ||
| @{value} | ||
| </ExternalLinkWithIcon> | ||
| </div> | ||
| ); | ||
| } | ||
| case "org.telegram": { | ||
| return ( | ||
| <div key={key} className="inline-flex items-center gap-2"> | ||
| <SiTelegram size={16} className="text-gray-500" /> | ||
| <ExternalLinkWithIcon href={`https://t.me/${value}`} className="text-sm"> | ||
| @{value} | ||
| </ExternalLinkWithIcon> | ||
| </div> | ||
| ); | ||
| } | ||
| case "com.linkedin": { | ||
| return ( | ||
| <div key={key} className="inline-flex items-center gap-2"> | ||
| <LinkedInIcon className="text-gray-500 size-4 fill-current" /> | ||
| <ExternalLinkWithIcon | ||
| href={`https://linkedin.com/in/${value}`} | ||
| className="text-sm" | ||
| > | ||
| {value} | ||
| </ExternalLinkWithIcon> | ||
| </div> | ||
| ); | ||
| } | ||
| case "com.reddit": { | ||
| return ( | ||
| <div key={key} className="inline-flex items-center gap-2"> | ||
| <SiReddit size={16} className="text-gray-500" /> | ||
| <ExternalLinkWithIcon href={`https://reddit.com/u/${value}`} className="text-sm"> | ||
| u/{value} | ||
| </ExternalLinkWithIcon> | ||
| </div> | ||
| ); | ||
| } | ||
| default: | ||
| console.warn(`Unsupported Social provided: '${key}' with value '${value}'.`); | ||
| return null; | ||
| } | ||
| })} | ||
| </CardContent> | ||
| </Card> | ||
| ); | ||
| } | ||
|
|
||
| SocialLinks.Texts = function SocialLinksTexts({ | ||
| texts, | ||
| }: { texts: Record<string, string | null | undefined> }) { | ||
| const links = useMemo( | ||
| () => | ||
| SOCIAL_LINK_KEYS | ||
| // map social keys to a set of links | ||
| .map((key) => ({ key, value: texts[key] })) | ||
| // filter those links by those that exist | ||
| .filter( | ||
| (link): link is { key: SocialLinkKey; value: SocialLinkValue } => | ||
| typeof link.value === "string", | ||
| ), | ||
| [texts], | ||
| ); | ||
|
|
||
| return <SocialLinks links={links} />; | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.