-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rewrite codebase for better responsiveness
- Loading branch information
1 parent
761a643
commit a3595d0
Showing
30 changed files
with
388 additions
and
181 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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Flex, Affix } from "@mantine/core"; | ||
|
||
export function SmallScreen(props: { | ||
children: React.ReactNode; | ||
leftSection?: React.ReactNode; | ||
rightSection?: React.ReactNode; | ||
position: { bottom?: number; right?: number; top?: number; left?: number; }; | ||
}) { | ||
const { children, leftSection, rightSection, position } = props; | ||
|
||
return ( | ||
<Affix position={position}> | ||
<Flex gap="sm" className="w-screen" justify={ | ||
position.right ? "end" : "start" | ||
}> | ||
{ leftSection } | ||
{ children } | ||
{ rightSection } | ||
</Flex> | ||
</Affix> | ||
) | ||
} |
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
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
frontend/src/components/Settings/AppActions/Actions/ActionsWrapper.tsx
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,61 @@ | ||
import { useState, useRef } from "react"; | ||
import { Flex } from "@mantine/core"; | ||
import { CopyUrlAction } from "./CopyUrlAction"; | ||
import { HelpPanelAction } from "./HelpPanelAction"; | ||
import { FilteringPanelAction } from "./FilteringPanelAction"; | ||
import { SettingsPanelAction } from "./SettingsPanelAction"; | ||
import { WalletPanelAction } from "./WalletPanelAction"; | ||
import { SearchBar } from "../../SearchBar"; | ||
import { StartTooltip } from "../../StartTooltip"; | ||
import { SearchAction } from "./SearchAction"; | ||
import { useSmallScreen } from "../../../../hooks/useSmallScreen"; | ||
|
||
export function ActionsWrapper(props: { | ||
onOpenWallets: () => void; | ||
onOpenMapOptions: () => void; | ||
onOpenFiltering: () => void; | ||
onOpenHelp: () => void; | ||
}) { | ||
const isSmallScreen = useSmallScreen(); | ||
const [isSearchOpen, setIsSearchOpen] = useState(false); | ||
const searchBarRef = useRef<{ focus: () => void }>(null); | ||
|
||
const onToggleSearch = () => { | ||
setIsSearchOpen((prev) => { | ||
if (!prev) { | ||
setTimeout(() => searchBarRef.current?.focus(), 0); | ||
} | ||
return !prev; | ||
}); | ||
} | ||
|
||
return ( | ||
<Flex | ||
direction={isSmallScreen ? 'column' : 'row'} | ||
align={isSmallScreen ? 'baseline' : 'end'} | ||
gap="xs" | ||
className="w-screen md:w-auto pt-2 md:pt-0"> | ||
{ | ||
isSmallScreen | ||
? isSearchOpen && <SearchBar ref={searchBarRef} /> | ||
: <SearchBar ref={searchBarRef} /> | ||
} | ||
{ isSmallScreen && <StartTooltip onClick={props.onOpenWallets} /> } | ||
<Flex | ||
className="w-full md:w-auto" | ||
direction="row" | ||
align="end" | ||
justify={isSmallScreen ? 'space-around' : 'end'} | ||
gap="xs"> | ||
<CopyUrlAction /> | ||
<WalletPanelAction onOpenWallets={props.onOpenWallets} /> | ||
<SettingsPanelAction onOpenMapOptions={props.onOpenMapOptions} /> | ||
<FilteringPanelAction onOpenFiltering={props.onOpenFiltering} /> | ||
<HelpPanelAction onOpenHelp={props.onOpenHelp} /> | ||
{ | ||
isSmallScreen && <SearchAction onToggleSearch={onToggleSearch} /> | ||
} | ||
</Flex> | ||
</Flex> | ||
) | ||
} |
20 changes: 20 additions & 0 deletions
20
frontend/src/components/Settings/AppActions/Actions/CopyUrlAction.tsx
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,20 @@ | ||
import { useTranslation } from "react-i18next"; | ||
import LinkIcon from '@mui/icons-material/Link'; | ||
import CheckIcon from '@mui/icons-material/Check'; | ||
import { AppActionsButton } from "../AppActionsButton"; | ||
import { useCopyUrl } from "../../../../hooks/useCopyUrl"; | ||
|
||
export function CopyUrlAction() { | ||
const { t } = useTranslation('common'); | ||
const { copied, onCopyUrl } = useCopyUrl(); | ||
|
||
return ( | ||
<AppActionsButton opened={false} open={onCopyUrl} label={t('actions.copyUrl')} color={copied ? 'teal' : ''}> | ||
{ | ||
!copied | ||
? <LinkIcon fontSize="large" /> | ||
: <CheckIcon fontSize="large" /> | ||
} | ||
</AppActionsButton> | ||
) | ||
} |
Oops, something went wrong.