generated from NEARBuilders/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62cc211
commit 05af262
Showing
13 changed files
with
283 additions
and
17 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
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 |
---|---|---|
|
@@ -31,6 +31,7 @@ yarn-error.log* | |
|
||
# vercel | ||
.vercel | ||
.turbo | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
|
Empty file.
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,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Profile Module</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/index.jsx"></script> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {} | ||
} | ||
}; |
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,36 @@ | ||
import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack'; | ||
import { defineConfig } from '@rsbuild/core'; | ||
import { pluginReact } from '@rsbuild/plugin-react'; | ||
|
||
|
||
export default defineConfig({ | ||
server: { | ||
port: 5170, | ||
}, | ||
output: { | ||
distPath: { | ||
root: 'dist' | ||
}, | ||
}, | ||
tools: { | ||
rspack: { | ||
plugins: [new ModuleFederationPlugin({ | ||
name: 'profile', | ||
filename: 'profile/remoteEntry.js', | ||
exposes: { | ||
'./App': './src/App.jsx' | ||
}, | ||
experiments: { | ||
federationRuntime: 'hoisted' | ||
}, | ||
shared: { | ||
'react': { singleton: true, eager: true, requiredVersion: '^18.0.0' }, | ||
'react-dom': { singleton: true, eager: true, requiredVersion: '^18.0.0' } | ||
}, | ||
})] | ||
} | ||
}, | ||
plugins: [ | ||
pluginReact() | ||
] | ||
}); |
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,85 @@ | ||
import React from "react"; | ||
import ReactMarkdown from "react-markdown"; | ||
import "./index.css"; | ||
|
||
const fallbackUrl = | ||
"https://ipfs.near.social/ipfs/bafkreibmiy4ozblcgv3fm3gc6q62s55em33vconbavfd2ekkuliznaq3zm"; | ||
|
||
const getImageUrl = (image) => { | ||
if (image?.url) return image.url; | ||
if (image?.ipfs_cid) return `https://ipfs.near.social/ipfs/${image.ipfs_cid}`; | ||
return fallbackUrl; | ||
}; | ||
|
||
function getSocialLink(platform, username) { | ||
const links = { | ||
github: `https://github.com/${username}`, | ||
telegram: `https://t.me/${username}`, | ||
linkedin: `https://linkedin.com/in/${username}`, | ||
twitter: `https://twitter.com/${username}`, | ||
website: `https://${username}` | ||
}; | ||
return links[platform] || "#"; | ||
} | ||
|
||
function getSocialIcon(platform) { | ||
const icons = { | ||
github: "📂", | ||
telegram: "📞", | ||
linkedin: "💼", | ||
twitter: "🐦", | ||
website: "🌐" | ||
}; | ||
return icons[platform] || "🔗"; | ||
} | ||
|
||
export default ({ accountId, profile }) => { | ||
if (!profile) { | ||
return ( | ||
<div className="p-8 text-center text-xl text-red-500"> | ||
Profile not found | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div | ||
className="margin-auto relative flex min-h-screen w-full flex-col items-center justify-center bg-cover bg-center py-16" | ||
style={{ | ||
backgroundImage: `url(${getImageUrl(profile?.backgroundImage) || ""})` | ||
}} | ||
> | ||
<div className="z-10 w-full max-w-2xl rounded-xl bg-white bg-opacity-95 p-8 text-center shadow-2xl backdrop-blur-sm lg:max-w-[1024px]"> | ||
<div className="w-full"> | ||
<img | ||
src={getImageUrl(profile?.image)} | ||
alt={profile?.name} | ||
className="mx-auto mb-4 h-32 w-32 rounded-full object-cover shadow-lg" | ||
/> | ||
<h1 className="mb-1 text-5xl font-bold text-gray-800"> | ||
{profile?.name} | ||
</h1> | ||
<p className="text-gray-600 mb-4">@{accountId}</p> | ||
<div className="markdown-content mb-6 rounded-lg bg-gray-50 p-4 text-left text-gray-700 shadow-inner"> | ||
<ReactMarkdown>{profile?.description || ""}</ReactMarkdown> | ||
</div> | ||
<div className="mt-6 flex flex-wrap justify-center gap-3"> | ||
{Object.entries(profile?.linktree || {}).map( | ||
([platform, username]) => ( | ||
<a | ||
key={platform} | ||
href={getSocialLink(platform, username)} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="bg-opacity-600 hover:bg-opacity-700 flex h-10 w-10 items-center justify-center rounded-full bg-white p-2 text-white shadow-md transition-all duration-300 hover:bg-white hover:shadow-lg" | ||
> | ||
{getSocialIcon(platform)} | ||
</a> | ||
) | ||
)} | ||
</div> | ||
</div> | ||
</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,11 @@ | ||
import React from 'react'; | ||
import * as ReactDOMClient from 'react-dom/client'; | ||
import App from './App'; | ||
|
||
const render = App => { | ||
const root = document.getElementById('root'); | ||
|
||
ReactDOMClient.createRoot(root, <App />); | ||
}; | ||
|
||
render(App); |
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,95 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
.markdown-content { | ||
line-height: 1.6; | ||
} | ||
.markdown-content h1 { | ||
font-size: 1.8em; | ||
margin-top: 0.5em; | ||
margin-bottom: 0.5em; | ||
font-weight: bold; | ||
} | ||
.markdown-content h2 { | ||
font-size: 1.5em; | ||
margin-top: 0.6em; | ||
margin-bottom: 0.6em; | ||
font-weight: bold; | ||
} | ||
.markdown-content h3 { | ||
font-size: 1.3em; | ||
margin-top: 0.7em; | ||
margin-bottom: 0.7em; | ||
font-weight: bold; | ||
} | ||
.markdown-content h4, .markdown-content h5, .markdown-content h6 { | ||
font-size: 1.1em; | ||
margin-top: 0.8em; | ||
margin-bottom: 0.8em; | ||
font-weight: bold; | ||
} | ||
.markdown-content p { | ||
margin-top: 0.5em; | ||
margin-bottom: 0.5em; | ||
} | ||
.markdown-content ul, .markdown-content ol { | ||
padding-left: 1.5em; | ||
margin-top: 0.5em; | ||
margin-bottom: 0.5em; | ||
} | ||
.markdown-content ul { | ||
list-style-type: disc; | ||
} | ||
.markdown-content ol { | ||
list-style-type: decimal; | ||
} | ||
.markdown-content li { | ||
margin-bottom: 0.3em; | ||
} | ||
.markdown-content a { | ||
color: #4a22a5; | ||
text-decoration: underline; | ||
} | ||
.markdown-content a:hover { | ||
color: #3a1a84; | ||
} | ||
.markdown-content blockquote { | ||
border-left: 3px solid #ccc; | ||
margin: 0.5em 0; | ||
padding-left: 1em; | ||
font-style: italic; | ||
} | ||
.markdown-content code { | ||
background-color: #f0f0f0; | ||
padding: 0.2em 0.4em; | ||
border-radius: 3px; | ||
font-family: monospace; | ||
} | ||
.markdown-content pre { | ||
background-color: #f0f0f0; | ||
padding: 0.8em; | ||
overflow-x: auto; | ||
border-radius: 5px; | ||
} | ||
.markdown-content pre code { | ||
background-color: transparent; | ||
padding: 0; | ||
} | ||
.markdown-content hr { | ||
border: 0; | ||
border-top: 1px solid #ccc; | ||
margin: 0.5em 0; | ||
} | ||
.markdown-content table { | ||
border-collapse: collapse; | ||
margin: 0.5em 0; | ||
} | ||
.markdown-content th, .markdown-content td { | ||
border: 1px solid #ccc; | ||
padding: 0.3em; | ||
} | ||
.markdown-content img { | ||
max-width: 100%; | ||
height: auto; | ||
} |
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 @@ | ||
import('./bootstrap'); |
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,11 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: [ | ||
"./index.html", | ||
"./src/**/*.{js,ts,jsx,tsx}", | ||
], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
} |