Skip to content

Commit

Permalink
feat: Add option to toggle popup lite mode (#2314)
Browse files Browse the repository at this point in the history
  • Loading branch information
xcv58 authored Feb 15, 2023
1 parent 4990499 commit c8d9002
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
9 changes: 6 additions & 3 deletions packages/extension/src/js/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default observer(() => {
const query = useQuery()
const isPopup = !query.has(NOT_POPUP)
const { windowStore, shortcutStore, userStore } = useStore()
const { toolbarAutoHide, litePopupMode } = userStore
const liteMode = isPopup && litePopupMode
useEffect(() => {
windowStore.didMount()
shortcutStore.didMount()
Expand All @@ -28,12 +30,13 @@ export default observer(() => {
<main
className={classNames(
'flex flex-col h-screen overflow-hidden',
{ 'pb-12': !userStore.toolbarAutoHide },
{ 'pb-12': !toolbarAutoHide },
useTextClasses()
)}
>
{isPopup && <PopupView />}
{!isPopup && (
{liteMode ? (
<PopupView />
) : (
<>
<DroppableTools />
<WinList />
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/src/js/components/Tab/TabContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const TabContent = observer(
</div>
)
return (
<Tooltip {...{ open, title: tooltip }} interactive>
<Tooltip {...{ open, title: tooltip }}>
<button
ref={buttonRef}
onClick={activate}
Expand Down
12 changes: 12 additions & 0 deletions packages/extension/src/js/components/Toolbar/SettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export default observer(() => {
toggleShowAppWindow,
showUnmatchedTab,
toggleShowUnmatchedTab,
litePopupMode,
toggleLitePopupMode,
showShortcutHint,
toggleShowShortcutHint,
toolbarAutoHide,
Expand Down Expand Up @@ -225,6 +227,16 @@ export default observer(() => {
</FormGroup>
<FormGroup>
<FormHelperText>Others</FormHelperText>
<FormControlLabel
label="Lite Popup Mode"
control={
<Switch
color="primary"
checked={litePopupMode}
onChange={toggleLitePopupMode}
/>
}
/>
<FormControlLabel
label="Show Shortcut Hint"
control={
Expand Down
10 changes: 9 additions & 1 deletion packages/extension/src/js/stores/UserStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const DEFAULT_SETTINGS = {
showAppWindow: false,
showShortcutHint: true,
showUnmatchedTab: true,
litePopupMode: false,
toolbarAutoHide: false,
highlightDuplicatedTab: true,
showTabTooltip: true,
Expand Down Expand Up @@ -36,6 +37,7 @@ export default class UserStore {
showAppWindow: observable,
showShortcutHint: observable,
showUnmatchedTab: observable,
litePopupMode: observable,
toolbarAutoHide: observable,
highlightDuplicatedTab: observable,
showTabTooltip: observable,
Expand Down Expand Up @@ -92,6 +94,7 @@ export default class UserStore {
showAppWindow = false
showShortcutHint = true
showUnmatchedTab = true
litePopupMode = false
toolbarAutoHide = false
highlightDuplicatedTab = true
showTabTooltip = true
Expand Down Expand Up @@ -199,6 +202,11 @@ export default class UserStore {
this.save()
}

toggleLitePopupMode = () => {
this.litePopupMode = !this.litePopupMode
this.save()
}

toggleAutoFocusSearch = () => {
this.autoFocusSearch = !this.autoFocusSearch
this.save()
Expand Down Expand Up @@ -230,7 +238,7 @@ export default class UserStore {
this.init()
}

toggleDarkTheme = (currentTheme: string) => {
toggleDarkTheme = (currentTheme: boolean) => {
browser.storage.sync.set({
useSystemTheme: false,
darkTheme: !currentTheme,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit c8d9002

@vercel
Copy link

@vercel vercel bot commented on c8d9002 Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.