-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
120 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'anki-templates': minor | ||
--- | ||
|
||
feat(all): embed options (嵌入选项) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import OptionsPage from './options'; | ||
import SettingsPage from './settings'; | ||
import ToolsPage from './tools'; | ||
import { Page, PageMap } from '@/hooks/use-page'; | ||
|
||
export const DEFAULT_PAGES: PageMap = { | ||
[Page.Settings]: SettingsPage, | ||
[Page.Tools]: ToolsPage, | ||
[Page.Options]: OptionsPage, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Block } from '@/components/block'; | ||
import { useNavigate, Page } from '@/hooks/use-page'; | ||
import * as t from 'at/i18n'; | ||
import { id } from 'at/options'; | ||
import { useMemo } from 'react'; | ||
|
||
export default () => { | ||
const navigate = useNavigate(); | ||
const options = useMemo(() => { | ||
const options = Object.fromEntries( | ||
Object.keys(localStorage) | ||
.filter( | ||
(key) => | ||
(key.startsWith('at:_global:') || key.startsWith(`at:${id}:`)) && | ||
!!localStorage.getItem(key), | ||
) | ||
.map((key) => [key, localStorage.getItem(key)]), | ||
); | ||
return JSON.stringify(options, undefined, 2); | ||
}, []); | ||
|
||
return ( | ||
<Block | ||
name={t.optionsPage} | ||
action={t.back} | ||
onAction={() => navigate(Page.Settings)} | ||
> | ||
<div className="prose prose-sm prose-neutral dark:prose-invert"> | ||
<p | ||
dangerouslySetInnerHTML={{ | ||
__html: t.optionsHelp, | ||
}} | ||
/> | ||
<pre>{options}</pre> | ||
</div> | ||
</Block> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters