Skip to content

Commit f7fd785

Browse files
authored
Merge pull request #1517 from scroll-tech/for-user-portal
For user portal
2 parents adab04c + 5b7d2b2 commit f7fd785

File tree

7 files changed

+68
-49
lines changed

7 files changed

+68
-49
lines changed

next.config.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ const nextConfig = {
8181
{ source: "/blog/scrollsFreshCoat", destination: "/blog/scrolls-fresh-coat", permanent: true },
8282

8383
{ source: "/sticker-vote", destination: "/sticker-winners", permanent: true },
84+
{ source: "/bridge", destination: `${process.env.NEXT_PUBLIC_USER_PORTAL_BASE_URL}/bridge`, permanent: true },
85+
{ source: "/sessions", destination: `${process.env.NEXT_PUBLIC_USER_PORTAL_BASE_URL}/sessions`, permanent: true },
8486
// { source: "/airdrop-faq", destination: "https://scroll-faqs.gitbook.io/faqs", permanent: false},
8587

8688
{

src/components/Header/MenuItem.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { sendGAEvent } from "@next/third-parties/google"
22

3-
import { ListItemButton } from "@mui/material"
3+
import { Box, ListItemButton, Typography } from "@mui/material"
44

55
import ExternalLinkSvg from "@/assets/svgs/common/external-link.svg"
66
import Link from "@/components/Link"
77

88
const MenuItem = props => {
9-
const { mode, children, label, href, reloadDocument, isActive, dark, sx } = props
9+
const { mode, children, label, href, reloadDocument, isActive, isNew, dark, sx } = props
1010
const isExternal = href?.startsWith("http")
1111

1212
const handleTrackEvent = () => {
@@ -17,7 +17,7 @@ const MenuItem = props => {
1717
}
1818

1919
return (
20-
<Link href={href} target={isExternal ? "_blank" : "_self"} reloadDocument={reloadDocument}>
20+
<Link href={href} external={isExternal} reloadDocument={reloadDocument}>
2121
<ListItemButton
2222
className="group"
2323
sx={{
@@ -39,6 +39,11 @@ const MenuItem = props => {
3939
onClick={handleTrackEvent}
4040
>
4141
{children}
42+
{isNew && (
43+
<Box sx={{ backgroundColor: "#B5F5EC", padding: "0 0.8rem", height: "2rem", lineHeight: "2rem", borderRadius: "0.4rem", ml: "-0.4rem" }}>
44+
<Typography sx={{ fontSize: "1.2rem", lineHeight: "2rem", fontWeight: 600 }}>NEW</Typography>
45+
</Box>
46+
)}
4247
{mode === "desktop" && isExternal && (
4348
<span className="invisible relative -translate-x-2 transition-transform group-hover:visible group-hover:translate-x-0">
4449
<ExternalLinkSvg className="w-[1rem] h-auto"></ExternalLinkSvg>

src/components/Header/data.ts

+45-37
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { BRIDGE_URL, LEVEL_UP_URL, SCROLL_OPEN_URL, SESSIONS_URL } from "@/constants/link"
12
import { isSepolia } from "@/utils"
23

34
interface MenuItem {
@@ -6,14 +7,15 @@ interface MenuItem {
67
key: string
78
href: string
89
reload?: boolean
10+
isNew?: boolean
911
}
1012

1113
interface Navigation {
1214
label: string
1315
key: string
1416

1517
children?: MenuItem[]
16-
new?: boolean
18+
isNew?: boolean
1719

1820
href?: string
1921
reload?: boolean
@@ -34,13 +36,13 @@ const sepoliaNavigations: Navigation[] = [
3436
rootKey: "build",
3537
label: "Scroll Open",
3638
key: "scroll-open",
37-
href: "https://open.scroll.io",
39+
href: SCROLL_OPEN_URL,
3840
},
3941
{
4042
rootKey: "build",
4143
label: "Level Up",
4244
key: "level-up",
43-
href: "https://www.levelup.xyz/",
45+
href: LEVEL_UP_URL,
4446
},
4547
{
4648
rootKey: "build",
@@ -59,7 +61,7 @@ const sepoliaNavigations: Navigation[] = [
5961
{
6062
label: "Bridge",
6163
key: "bridge",
62-
href: "/bridge",
64+
href: BRIDGE_URL,
6365
},
6466
]
6567

@@ -78,75 +80,81 @@ const mainnetNavigations: Navigation[] = [
7880
rootKey: "build",
7981
label: "Scroll Open",
8082
key: "scroll-open",
81-
href: "https://open.scroll.io",
83+
href: SCROLL_OPEN_URL,
8284
},
8385
{
8486
rootKey: "build",
8587
label: "Level Up",
8688
key: "level-up",
87-
href: "https://www.levelup.xyz/",
89+
href: LEVEL_UP_URL,
8890
},
8991
{
9092
rootKey: "build",
9193
label: "Block Explorer",
9294
key: "block-explorer",
9395
href: process.env.NEXT_PUBLIC_EXTERNAL_EXPLORER_URI_L2,
9496
},
97+
{
98+
rootKey: "participate",
99+
label: "Bug Bounty",
100+
key: "bug-bounty",
101+
href: "https://immunefi.com/bug-bounty/scroll/information/",
102+
},
95103
],
96104
},
97105
{
98-
label: "Explore",
99-
key: "explore",
106+
label: "Use",
107+
key: "use",
100108
children: [
101109
{
102-
rootKey: "explore",
110+
rootKey: "use",
111+
label: "User Portal",
112+
key: "portal",
113+
href: process.env.NEXT_PUBLIC_USER_PORTAL_BASE_URL,
114+
isNew: true,
115+
},
116+
{
117+
rootKey: "participate",
118+
label: "Session 2",
119+
key: "session-2",
120+
href: SESSIONS_URL,
121+
},
122+
{
123+
rootKey: "use",
103124
label: "Projects",
104125
key: "projects",
105126
href: "/ecosystem",
106127
},
107128
{
108-
rootKey: "explore",
129+
rootKey: "use",
109130
label: "Bridge",
110131
key: "bridge",
111-
href: "/bridge",
132+
href: BRIDGE_URL,
112133
},
113134
{
114-
rootKey: "explore",
115-
label: "SCR",
135+
rootKey: "use",
136+
label: "SCR & sSCR",
116137
key: "scr",
117138
href: "/SCR-sSCR",
118139
},
119-
],
120-
},
121-
{
122-
label: "Participate",
123-
key: "participate",
124-
children: [
125140
{
126-
rootKey: "participate",
127-
label: "Session 2",
128-
key: "session-2",
129-
href: "/sessions",
130-
reload: true,
141+
rootKey: "use",
142+
label: "scrETH",
143+
key: "scrETH",
144+
href: "/scrETH",
131145
},
132146
{
133-
rootKey: "participate",
147+
rootKey: "use",
134148
label: "Governance",
135149
key: "governance",
136150
href: "https://gov.scroll.io/info",
137151
},
138-
{
139-
rootKey: "participate",
140-
label: "Community",
141-
key: "community",
142-
href: "/community",
143-
},
144-
{
145-
rootKey: "participate",
146-
label: "Bug Bounty",
147-
key: "bug-bounty",
148-
href: "https://immunefi.com/bug-bounty/scroll/information/",
149-
},
152+
// {
153+
// rootKey: "use",
154+
// label: "Community",
155+
// key: "community",
156+
// href: "/community",
157+
// },
150158
],
151159
},
152160
{

src/components/Header/desktop_header.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const DesktopHeader = ({ currentMenu }) => {
5555
<NavbarItem
5656
isActive={currentMenu.includes(item.key)}
5757
isHovering={hoveringNavbarItemKey === item.key}
58-
isNew={item.new}
58+
isNew={item.isNew}
5959
dark={dark}
6060
onMouseEnter={e => handleMouseEnter(e, item.key)}
6161
onMouseLeave={handleMouseLeave}
@@ -89,12 +89,13 @@ const DesktopHeader = ({ currentMenu }) => {
8989
}}
9090
>
9191
<Stack direction="column" onClick={handleMouseLeave}>
92-
{item.children.map(({ key, label, href, reload }) => (
92+
{item.children.map(({ key, label, isNew, href, reload }) => (
9393
<MenuItem
9494
mode="desktop"
9595
key={key}
9696
sx={{ p: "0.8rem" }}
9797
isActive={key === currentMenu[0]}
98+
isNew={isNew}
9899
label={label}
99100
dark={isLandscape ? false : dark}
100101
href={href}
@@ -117,7 +118,7 @@ const DesktopHeader = ({ currentMenu }) => {
117118
return (
118119
<ScrollLink href={item.href} reloadDocument={item.reload} external={item.href?.startsWith("https")}>
119120
<NavbarItem
120-
isNew={item.new}
121+
isNew={item.isNew}
121122
isActive={currentMenu.includes(item.key)}
122123
dark={dark}
123124
expendMore={false}

src/components/Header/mobile_header.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const MobileHeader = ({ currentMenu }) => {
8686
<MobileNavbarItem
8787
dark={dark}
8888
label={item.label}
89-
isNew={item.new}
89+
isNew={item.isNew}
9090
isActive={activeCollapse === item.key}
9191
onClick={() => toggleCollapse(item.key)}
9292
></MobileNavbarItem>
@@ -95,7 +95,7 @@ const MobileHeader = ({ currentMenu }) => {
9595
<MobileNavbarItem
9696
dark={dark}
9797
label={item.label}
98-
isNew={item.new}
98+
isNew={item.isNew}
9999
isActive={activeCollapse === item.key}
100100
expendMore={false}
101101
onClick={() => handleClickMenuItem(item.label)}
@@ -105,12 +105,13 @@ const MobileHeader = ({ currentMenu }) => {
105105

106106
<Collapse key={item.key} in={activeCollapse === item.key} timeout="auto" unmountOnExit>
107107
<List component="div" disablePadding>
108-
{item.children?.map(({ key, label, href, reload }) => (
108+
{item.children?.map(({ key, label, isNew, href, reload }) => (
109109
<MenuItem
110110
mode="mobile"
111111
key={key}
112112
sx={{ mb: "2.4rem" }}
113113
isActive={key === currentMenu[0]}
114+
isNew={isNew}
114115
label={label}
115116
dark={dark}
116117
href={href}

src/constants/link.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ export const DOC_URL = "https://docs.scroll.io/en/home/"
22
export const SCROLL_OPEN_URL = "https://open.scroll.io"
33
export const LEVEL_UP_URL = "https://www.levelup.xyz/"
44

5-
export const BRIDGE_URL = "/bridge"
5+
const USER_PORTAL_BASE_URL = process.env.NEXT_PUBLIC_USER_PORTAL_BASE_URL
6+
7+
export const BRIDGE_URL = `${USER_PORTAL_BASE_URL}/bridge`
68
export const ECOSYSTEM_URL = "/ecosystem"
7-
export const SESSIONS_URL = "/sessions"
9+
export const SESSIONS_URL = `${USER_PORTAL_BASE_URL}/sessions`
810

911
export const VISION_URL = "/blog/vision-and-values"
1012

src/middleware.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type NextRequest, NextResponse } from "next/server"
22

33
export function middleware(request: NextRequest) {
44
if (request.nextUrl.pathname === "/" && process.env.NEXT_PUBLIC_SCROLL_ENVIRONMENT === "Sepolia") {
5-
const response = NextResponse.redirect(new URL("/bridge", request.url))
5+
const response = NextResponse.redirect(new URL("/portal", request.url))
66
return response
77
}
88

0 commit comments

Comments
 (0)