Skip to content

Commit

Permalink
Revert "Add gateway routing (#287)" (#295)
Browse files Browse the repository at this point in the history
This reverts commit a5c7528.
  • Loading branch information
elliotBraem authored and Megha-Dev-19 committed May 14, 2024
1 parent 286617f commit 485fe85
Show file tree
Hide file tree
Showing 17 changed files with 171 additions and 292 deletions.
19 changes: 1 addition & 18 deletions apps/builddao/widget/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,19 @@ const config = {
// customize your header
<Widget
src="${config_account}/widget/components.Navbar"
props={{
routes: config.router.routes,
...passProps,
page: props.page,
fromGateway: props.fromGateway,
}}
props={{ routes: config.router.routes, ...passProps, page: props.page }}
/>
),
Footer: () => <></>, // customize your footer
},
router: {
param: "page",
commonInit: {
fromGateway: props.fromGateway,
},
routes: {
home: {
path: "${config_account}/widget/page.home",
blockHeight: "final",
init: {
name: "Home",
...commonInit,
},
default: true,
},
Expand All @@ -53,15 +44,13 @@ const config = {
blockHeight: "final",
init: {
name: "Activity",
...commonInit,
},
},
projects: {
path: "${config_account}/widget/page.projects",
blockHeight: "final",
init: {
name: "Projects",
...commonInit,
},
hide: true,
},
Expand All @@ -70,7 +59,6 @@ const config = {
blockHeight: "final",
init: {
name: "Proposals",
...commonInit,
},
hide: true,
},
Expand All @@ -79,23 +67,20 @@ const config = {
blockHeight: "final",
init: {
name: "Resources",
...commonInit,
},
},
library: {
path: "${config_account}/widget/page.library",
blockHeight: "final",
init: {
name: "Library",
...commonInit,
},
},
profile: {
path: "${config_account}/widget/page.profile",
blockHeight: "final",
init: {
name: "Profile",
...commonInit,
},
hide: true,
},
Expand All @@ -104,7 +89,6 @@ const config = {
blockHeight: "final",
init: {
name: "Inspect",
...commonInit,
},
hide: true,
},
Expand All @@ -113,7 +97,6 @@ const config = {
blockHeight: "final",
init: {
name: "Project Page",
...commonInit,
},
hide: true,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/builddao/widget/app/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ if (!config) {
}
}

console.log("config", config);

if (!config) {
return (
<p>
Expand Down
165 changes: 75 additions & 90 deletions apps/builddao/widget/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ const unreadNotifications = getNotificationCount();
function Navbar(props) {
const { page, routes } = props;
const [dropdown, setDropdown] = useState(false);
const fromGateway = props.fromGateway ?? false;

const toggleDropdown = () => {
setDropdown((prev) => !prev);
Expand All @@ -264,16 +263,12 @@ function Navbar(props) {
<MainContent className="container-xl">
<Left>
<Link
to={
!fromGateway
? href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "home",
},
})
: `/`
}
to={href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "home",
},
})}
className="d-flex align-items-center"
>
<img
Expand All @@ -293,18 +288,12 @@ function Navbar(props) {
<Link
key={`desktop=${k}`}
style={{ textDecoration: "none" }}
to={
!fromGateway
? href({
widgetSrc: "${config_account}/widget/app",
params: {
page: k,
},
})
: k === "home"
? "/"
: `/${k}`
}
to={href({
widgetSrc: "${config_account}/widget/app",
params: {
page: k,
},
})}
>
<span key={k} className={page === k ? "active" : null}>
{route.init.icon && <i className={route.init.icon}></i>}
Expand All @@ -320,16 +309,12 @@ function Navbar(props) {
<Button
className="rounded-3 position-relative"
type="icon"
href={
!fromGateway
? href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "notifications",
},
})
: "/notifications"
}
href={href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "notifications",
},
})}
>
<i className="bi bi-bell"></i>
{unreadNotifications > 0 && (
Expand Down Expand Up @@ -360,52 +345,56 @@ function Navbar(props) {
gap: "0.5rem",
}}
>
<StyledDropdown className="dropdown">
<button
className="dropdown-toggle"
type="button"
id="dropdownMenu2222"
data-bs-toggle="dropdown"
aria-expanded="false"
>
<i style={{ color: "white" }} className="bi bi-three-dots"></i>
</button>
<ul className="dropdown-menu" aria-labelledby="dropdownMenu2222">
<li>
<Link
style={{ textDecoration: "none" }}
href={
!fromGateway
? href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "inspect",
widgetPath: routes[page].path,
},
})
: `/inspect/${routes[page].path}`
}
type="icon"
variant="outline"
className="d-flex align-tiems-center gap-2"
>
<i className="bi bi-code"></i>
<span>View source</span>
</Link>
</li>
<li>
<Link
style={{ textDecoration: "none" }}
href={`/edit/${routes[page].path}`}
type="icon"
variant="outline"
className="d-flex align-items-center gap-2"
>
<i className="bi bi-pencil"></i>
<span>Edit code</span>
</Link>
</li>
</ul>
<StyledDropdown className="dropdown ">
<div className="d-flex justify-content-end align-items-center gap-3">
<button
className="dropdown-toggle"
type="button"
id="dropdownMenu2222"
data-bs-toggle="dropdown"
aria-expanded="false"
>
<i
style={{ color: "white" }}
className="bi bi-three-dots"
></i>
</button>
<ul
className="dropdown-menu"
aria-labelledby="dropdownMenu2222"
>
<li>
<Link
style={{ textDecoration: "none" }}
href={href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "inspect",
widgetPath: routes[page].path,
},
})}
type="icon"
variant="outline"
className="d-flex align-tiems-center gap-2"
>
<i className="bi bi-code"></i>
<span>View source</span>
</Link>
</li>
<li>
<Link
style={{ textDecoration: "none" }}
href={`/edit/${routes[page].path}`}
type="icon"
variant="outline"
className="d-flex align-items-center gap-2"
>
<i className="bi bi-pencil"></i>
<span>Edit code</span>
</Link>
</li>
</ul>
</div>
</StyledDropdown>
{context.accountId ? (
<Widget
Expand Down Expand Up @@ -550,17 +539,13 @@ function Navbar(props) {
<Button
linkClassName="d-flex w-100"
className="w-100"
href={
!fromGateway
? href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "inspect",
widgetPath: routes[page].path,
},
})
: `/inspect/${routes[page].path}`
}
href={href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "inspect",
widgetPath: routes[page].path,
},
})}
>
<span>View source</span>
</Button>
Expand Down
20 changes: 8 additions & 12 deletions apps/builddao/widget/components/buttons/Connect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const { href: linkHref } = VM.require("${config_account}/widget/lib.url") || {
href: () => {},
};

const Component = (props) => {
const Component = () => {
if (!context.accountId) {
return (
<Button
Expand All @@ -148,16 +148,12 @@ const Component = (props) => {
</Bullet>
<Link
style={{ color: "#df9731", fontWeight: 600 }}
to={
!props.fromGateway
? linkHref({
widgetSrc: "${config_account}/widget/app",
params: {
page: "feed",
},
})
: "/feed"
}
to={linkHref({
widgetSrc: "${config_account}/widget/app",
params: {
page: "feed",
},
})}
>
View Activity{" "}
<svg
Expand Down Expand Up @@ -196,6 +192,6 @@ const Component = (props) => {

return (
<Container>
<Component fromGateway={props.fromGateway} />
<Component />
</Container>
);
18 changes: 7 additions & 11 deletions apps/builddao/widget/components/buttons/UserDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,13 @@ return (
<Link
className="dropdown-item"
type="button"
to={
!props.fromGateway
? href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "profile",
accountId: context.accountId,
},
})
: `/profile/${context.accountId}`
}
to={href({
widgetSrc: "${config_account}/widget/app",
params: {
page: "profile",
accountId: context.accountId,
},
})}
>
<User />
My Profile
Expand Down
1 change: 1 addition & 0 deletions apps/builddao/widget/components/modals/propose/Text.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ return (
proposalType: "Add Member",
}}
/>
{/* {console.log(notificationsData)} */}
<div className="w-100 d-flex">
<Button
className="ms-auto"
Expand Down
Loading

0 comments on commit 485fe85

Please sign in to comment.