Skip to content

Commit

Permalink
Are emojis working now?
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Sep 30, 2024
1 parent c8d94a8 commit f5b12ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
3 changes: 3 additions & 0 deletions packages/nextjs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export const metadata = getMetadata({
const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => {
return (
<html suppressHydrationWarning>
<head>
<meta charSet="UTF-8" />
</head>
<body>
<ThemeProvider enableSystem>
<ScaffoldEthAppWithProviders>{children}</ScaffoldEthAppWithProviders>
Expand Down
21 changes: 9 additions & 12 deletions packages/nextjs/app/profile/[address]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ const ProfilePage: NextPage = () => {
watch: true,
});

// Function to normalize URLs
const normalizeUrl = (url: string) => {
if (!url.startsWith("http://") && !url.startsWith("https://")) {
return `https://${url}`;
}
return url;
};

const { writeContractAsync: profileInfoWriteAsync } = useScaffoldWriteContract("ProfileInfo");

const {
Expand Down Expand Up @@ -174,10 +182,6 @@ const ProfilePage: NextPage = () => {
return <p>Inexistent address, try again...</p>;
}

// if (loading) {
// return <LoadingSpinner />;
// }

if (loading && page === 1) {
return <LoadingSpinner />;
}
Expand All @@ -186,13 +190,6 @@ const ProfilePage: NextPage = () => {
return <ErrorComponent message={createErrorReadingEvents?.message || "Error loading events"} />;
}

// const ensureHttps = (url: string) => {
// if (!/^https?:\/\//i.test(url)) {
// return `https://${url}`;
// }
// return url;
// };

return (
<>
<div className="flex flex-col items-center">
Expand Down Expand Up @@ -223,7 +220,7 @@ const ProfilePage: NextPage = () => {

{bio && <p className="text-base-content">{bio}</p>}
{website && (
<a href={website} target="_blank" rel="noopener noreferrer" className="text-blue-600">
<a href={normalizeUrl(website)} target="_blank" rel="noopener noreferrer" className="text-blue-600">
{website}
</a>
)}
Expand Down

0 comments on commit f5b12ec

Please sign in to comment.