-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config-based routing, wouter
v3
, custom useLocation()
/ navigate()
#556
Changes from 46 commits
cbd7574
6150087
5beaf0c
60377a8
7171c38
ffd83b9
bd94717
76bc10c
0b78ab6
48d7a70
f819c4b
26ef8d4
8e07997
2ae4dd9
c7c7964
8ddbc94
3b9a7dc
06fb97c
35ab26a
6a94bfe
46ea22b
1300615
2e3c95b
0c925ba
0ec54a3
b0993ef
fd9dd95
79d0343
4c3b8d8
4ef2f12
516cd80
c87eabf
b26ef26
695c34f
3d113d2
42742ac
2ee1591
3131d5a
fe37222
8d8488a
c3a0268
c61f654
42dfd93
fccb2f7
bd08652
2c67339
3b225de
f7bfaee
70f1042
2f2a5d9
248d3d4
630a7a6
f6ef12f
379ab20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn fmt | ||
git add -A | ||
git add -A |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>ArConnect Embedded Wallet</title> | ||
<meta charset="utf-8" /> | ||
<link rel="stylesheet" type="text/css" href="/assets/popup.css" /> | ||
</head> | ||
<body> | ||
<div id="cover"></div> | ||
<div id="root"></div> | ||
<!-- <script type="text/javascript" src="/assets/popup.js"></script> --> | ||
<script type="module" src="/src/iframe/main.tsx"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,27 @@ import { useEffect, useMemo, useState } from "react"; | |
import { useStorage } from "@plasmohq/storage/hook"; | ||
import { ExtensionStorage } from "~utils/storage"; | ||
import { SettingsList } from "./list/BaseElement"; | ||
import { useLocation, useRoute } from "wouter"; | ||
import { useRoute } from "wouter"; | ||
import Application from "~applications/application"; | ||
import AppListItem from "./list/AppListItem"; | ||
import browser from "webextension-polyfill"; | ||
import SearchInput from "./SearchInput"; | ||
import styled from "styled-components"; | ||
import { useLocation } from "~wallets/router/router.utils"; | ||
import type { CommonRouteProps } from "~wallets/router/router.types"; | ||
|
||
export interface ApplicationsDashboardViewParams { | ||
app?: string; | ||
} | ||
|
||
export type ApplicationsDashboardViewProps = | ||
CommonRouteProps<ApplicationsDashboardViewParams>; | ||
|
||
export function ApplicationsDashboardView() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You will see most changes in the PR are like this file:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🦸 |
||
const { navigate } = useLocation(); | ||
// TODO: Replace with useParams: | ||
const [, params] = useRoute<{ app?: string }>("/apps/:app?"); | ||
|
||
export default function Applications() { | ||
// connected apps | ||
const [connectedApps] = useStorage<string[]>( | ||
{ | ||
|
@@ -43,10 +56,6 @@ export default function Applications() { | |
})(); | ||
}, [connectedApps]); | ||
|
||
// router | ||
const [, params] = useRoute<{ app?: string }>("/apps/:app?"); | ||
const [, setLocation] = useLocation(); | ||
|
||
// active subsetting val | ||
const activeApp = useMemo( | ||
() => (params?.app ? decodeURIComponent(params.app) : undefined), | ||
|
@@ -60,7 +69,7 @@ export default function Applications() { | |
return; | ||
} | ||
|
||
setLocation("/apps/" + firstApp); | ||
navigate(`/apps/${firstApp}`); | ||
}, [connectedApps]); | ||
|
||
// search | ||
|
@@ -96,7 +105,7 @@ export default function Applications() { | |
url={app.url} | ||
icon={app.icon} | ||
active={activeApp === app.url} | ||
onClick={() => setLocation("/apps/" + encodeURIComponent(app.url))} | ||
onClick={() => navigate(`/apps/${encodeURIComponent(app.url)}`)} | ||
key={i} | ||
/> | ||
))} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,11 @@ import { createCoinWithAnimation } from "~api/modules/sign/animation"; | |
import { arconfettiIcon } from "~api/modules/sign/utils"; | ||
import { EventType, trackEvent } from "~utils/analytics"; | ||
|
||
export default function Setting({ setting }: Props) { | ||
export interface SettingDashboardViewProps { | ||
setting: SettingType; | ||
} | ||
|
||
export function SettingDashboardView({ setting }: SettingDashboardViewProps) { | ||
// setting state | ||
const [settingState, updateSetting] = useSetting(setting.name); | ||
|
||
|
@@ -132,14 +136,11 @@ export default function Setting({ setting }: Props) { | |
); | ||
|
||
default: | ||
// TODO: Should this be a redirect? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return <></>; | ||
} | ||
} | ||
|
||
interface Props { | ||
setting: SettingType; | ||
} | ||
|
||
export const RadioWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to the latest version, which already includes the functionality from
path-to-regepx
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍