Skip to content

Commit

Permalink
fix(hub): add layout pages to gov proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
BrownBrownBear committed Sep 26, 2024
1 parent f3baef8 commit 8311c86
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
10 changes: 10 additions & 0 deletions apps/hub/src/app/governance/proposal/[proposalId]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { FooterSM } from "@bera/shared-ui/src/footer";

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<section>
<div className="container min-h-minimum max-w-1280 pb-16">{children}</div>
<FooterSM />
</section>
);
}
10 changes: 10 additions & 0 deletions apps/hub/src/app/governance/proposal/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { FooterSM } from "@bera/shared-ui/src/footer";

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<section>
<div className="container min-h-minimum max-w-1280 pb-16">{children}</div>
<FooterSM />
</section>
);
}
19 changes: 13 additions & 6 deletions packages/shared-ui/src/identicon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"use client";

// @ts-nocheck
import { useLayoutEffect, useMemo, useRef } from "react";
import { useEffect, useMemo, useRef } from "react";
import { cn } from "@bera/ui";

import "./types/jazzicon.d.ts";
import jazzicon from "@metamask/jazzicon";

export default function Identicon({
Expand All @@ -15,17 +19,20 @@ export default function Identicon({
const iconSize = size ?? 24;

const icon = useMemo(
() => account && jazzicon(iconSize, parseInt(account.slice(2, 10), 16)),
() =>
account &&
typeof window !== "undefined" &&
jazzicon(iconSize, parseInt(account.slice(2, 10), 16)),
[account, iconSize],
);
const iconRef = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
useEffect(() => {
const current = iconRef.current;
if (icon) {
current?.appendChild(icon);
if (icon && current) {
current.appendChild(icon);
return () => {
try {
current?.removeChild(icon);
current.removeChild(icon);
} catch (e) {
console.error("Avatar icon not found");
}
Expand Down
3 changes: 3 additions & 0 deletions packages/shared-ui/src/types/jazzicon.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module "@metamask/jazzicon" {
export default function jazzicon(diameter: number, seed: number): HTMLElement;
}

0 comments on commit 8311c86

Please sign in to comment.