Skip to content

Commit

Permalink
Update icons.
Browse files Browse the repository at this point in the history
  • Loading branch information
oldj committed Apr 15, 2023
1 parent a56f81b commit 6983a38
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 50 deletions.
44 changes: 44 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@chakra-ui/react": "2.5.5",
"@emotion/react": "11.10.6",
"@emotion/styled": "11.10.6",
"@tabler/icons-react": "2.16.0",
"@types/assert": "1.5.6",
"@types/codemirror": "5.60.7",
"@types/express": "4.17.17",
Expand Down
18 changes: 10 additions & 8 deletions src/renderer/components/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import clsx from 'clsx'
import dayjs from 'dayjs'
import prettyBytes from 'pretty-bytes'
import React, { useState } from 'react'
import { BiDetail, BiHelpCircle, BiHistory, BiTrash } from 'react-icons/bi'
import useConfigs from '../models/useConfigs'
import useI18n from '../models/useI18n'
import useConfigs from '@renderer/models/useConfigs'
import useI18n from '@renderer/models/useI18n'
import styles from './History.module.scss'
import { IconFileTime, IconHelpCircle, IconHistory, IconX } from '@tabler/icons-react'

interface IHistoryProps {
list: IHostsHistoryObject[]
Expand Down Expand Up @@ -73,7 +73,7 @@ const HistoryList = (props: IHistoryProps): React.ReactElement => {
>
<HStack>
<Box>
<BiDetail />
<IconFileTime size={16} />
</Box>
<VStack align="left" spacing={0}>
<Box>{dayjs(item.add_time_ms).format('YYYY-MM-DD HH:mm:ss')}</Box>
Expand Down Expand Up @@ -152,7 +152,9 @@ const History = () => {

useOnBroadcast(events.show_history, () => {
setIsOpen(true)
loadData()
loadData().catch((e) => {
console.error(e)
})
})

let history_limit_values: number[] = [10, 50, 100, 500]
Expand All @@ -175,7 +177,7 @@ const History = () => {
<DrawerHeader>
<HStack>
<Box mr={1}>
<BiHistory />
<IconHistory size={16} />
</Box>
<Box>{lang.system_hosts_history}</Box>
</HStack>
Expand Down Expand Up @@ -208,12 +210,12 @@ const History = () => {
</Box>
<Tooltip label={lang.system_hosts_history_help} aria-label="A tooltip">
<Box ml={3}>
<BiHelpCircle />
<IconHelpCircle size={16} />
</Box>
</Tooltip>
<Spacer />
<Button
leftIcon={<BiTrash />}
leftIcon={<IconX size={16} />}
variant="outline"
mr={3}
colorScheme="pink"
Expand Down
27 changes: 13 additions & 14 deletions src/renderer/components/ItemIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@

import React from 'react'
import {
BiDesktop,
BiFile,
BiFolder,
BiFolderOpen,
BiGlobe,
BiLayer,
BiTrash,
} from 'react-icons/bi'
IconDeviceDesktop,
IconFileText,
IconFolder,
IconStack2,
IconTrash,
IconWorld,
} from '@tabler/icons-react'

interface Props {
type?: string
Expand All @@ -25,17 +24,17 @@ const ItemIcon = (props: Props) => {

switch (type) {
case 'folder':
return is_collapsed ? <BiFolder /> : <BiFolderOpen />
return is_collapsed ? <IconFolder size={16} /> : <IconFolder size={16} />
case 'remote':
return <BiGlobe />
return <IconWorld size={16} />
case 'group':
return <BiLayer />
return <IconStack2 size={16} />
case 'system':
return <BiDesktop />
return <IconDeviceDesktop size={16} />
case 'trashcan':
return <BiTrash />
return <IconTrash size={16} />
default:
return <BiFile />
return <IconFileText size={16} />
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/Pref/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import events from '@common/events'
import useConfigs from '@renderer/models/useConfigs'
import useI18n from '@renderer/models/useI18n'
import React, { useEffect, useState } from 'react'
import { BiSliderAlt } from 'react-icons/bi'
import Advanced from './Advanced'
import Commands from './Commands'
import General from './General'
import styles from './styles.module.scss'
import { IconAdjustments } from '@tabler/icons-react'

const PreferencePanel = () => {
const [is_open, setIsOpen] = useState(false)
Expand Down Expand Up @@ -84,7 +84,7 @@ const PreferencePanel = () => {
<DrawerHeader>
<HStack>
<Box mr={1}>
<BiSliderAlt />
<IconAdjustments size={16} />
</Box>
<Box>{lang.preferences}</Box>
</HStack>
Expand Down
51 changes: 29 additions & 22 deletions src/renderer/components/TopBar/ConfigMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ import useHostsData from '@renderer/models/useHostsData'
import useI18n from '@renderer/models/useI18n'
import React, { useState } from 'react'
import {
BiCog,
BiExit,
BiExport,
BiHomeCircle,
BiImport,
BiInfoCircle,
BiMessageDetail,
BiRefresh,
BiSliderAlt,
BiWrench,
} from 'react-icons/bi'
IconAdjustments,
IconCloudDownload,
IconCode,
IconDownload,
IconHome,
IconInfoCircle,
IconLogout,
IconMessage2,
IconRefresh,
IconSettings,
IconUpload,
} from '@tabler/icons-react'
import styles from './ConfigMenu.module.scss'

const ConfigMenu = () => {
Expand All @@ -44,22 +45,25 @@ const ConfigMenu = () => {
<>
<Menu>
<MenuButton as={Button} variant="ghost" width="35px" px="10.5px">
<BiCog />
<IconSettings size={16} />
</MenuButton>
<MenuList
borderColor="var(--swh-border-color-0)"
className={styles.menu_list}
maxH={'calc(100vh - 80px)'}
overflowY={'scroll'}
>
<MenuItem icon={<BiInfoCircle />} onClick={() => agent.broadcast(events.show_about)}>
<MenuItem
icon={<IconInfoCircle size={16} />}
onClick={() => agent.broadcast(events.show_about)}
>
{lang.about}
</MenuItem>

<MenuDivider />

<MenuItem
icon={<BiRefresh />}
icon={<IconRefresh size={16} />}
onClick={async () => {
let r = await actions.checkUpdate()
if (r === false) {
Expand All @@ -81,17 +85,17 @@ const ConfigMenu = () => {
>
{lang.check_update}
</MenuItem>
<MenuItem icon={<BiMessageDetail />} onClick={() => actions.openUrl(feedback_url)}>
<MenuItem icon={<IconMessage2 size={16} />} onClick={() => actions.openUrl(feedback_url)}>
{lang.feedback}
</MenuItem>
<MenuItem icon={<BiHomeCircle />} onClick={() => actions.openUrl(homepage_url)}>
<MenuItem icon={<IconHome size={16} />} onClick={() => actions.openUrl(homepage_url)}>
{lang.homepage}
</MenuItem>

<MenuDivider />

<MenuItem
icon={<BiExport />}
icon={<IconUpload size={16} />}
onClick={async () => {
let r = await actions.exportData()
if (r === null) {
Expand All @@ -114,7 +118,7 @@ const ConfigMenu = () => {
{lang.export}
</MenuItem>
<MenuItem
icon={<BiImport />}
icon={<IconDownload size={16} />}
onClick={async () => {
let r = await actions.importData()
if (r === null) {
Expand Down Expand Up @@ -144,7 +148,7 @@ const ConfigMenu = () => {
{lang.import}
</MenuItem>
<MenuItem
icon={<BiImport />}
icon={<IconCloudDownload size={16} />}
onClick={async () => {
setShowImportFromUrl(true)
}}
Expand All @@ -154,16 +158,19 @@ const ConfigMenu = () => {

<MenuDivider />

<MenuItem icon={<BiSliderAlt />} onClick={() => agent.broadcast(events.show_preferences)}>
<MenuItem
icon={<IconAdjustments size={16} />}
onClick={() => agent.broadcast(events.show_preferences)}
>
{lang.preferences}
</MenuItem>
<MenuItem icon={<BiWrench />} onClick={() => actions.cmdToggleDevTools()}>
<MenuItem icon={<IconCode size={16} />} onClick={() => actions.cmdToggleDevTools()}>
{lang.toggle_developer_tools}
</MenuItem>

<MenuDivider />

<MenuItem icon={<BiExit />} onClick={() => actions.quit()}>
<MenuItem icon={<IconLogout size={16} />} onClick={() => actions.quit()}>
{lang.quit}
</MenuItem>
</MenuList>
Expand Down
20 changes: 16 additions & 4 deletions src/renderer/components/TopBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ import events from '@common/events'
import useHostsData from '@renderer/models/useHostsData'
import useI18n from '@renderer/models/useI18n'
import React, { useEffect, useState } from 'react'
import { BiHistory, BiPlus, BiSidebar, BiX } from 'react-icons/bi'
import { BiX } from 'react-icons/bi'
import {
IconHistory,
IconLayoutSidebarLeftCollapse,
IconLayoutSidebarLeftExpand,
IconPlus,
} from '@tabler/icons-react'
import styles from './index.module.scss'

interface IProps {
Expand Down Expand Up @@ -54,7 +60,13 @@ export default (props: IProps) => {
<Flex align="center" className={styles.left}>
<IconButton
aria-label="Toggle sidebar"
icon={<BiSidebar />}
icon={
show_left_panel ? (
<IconLayoutSidebarLeftCollapse size={16} />
) : (
<IconLayoutSidebarLeftExpand size={16} />
)
}
onClick={() => {
agent.broadcast(events.toggle_left_panel, !show_left_panel)
}}
Expand All @@ -63,7 +75,7 @@ export default (props: IProps) => {
/>
<IconButton
aria-label="Add"
icon={<BiPlus />}
icon={<IconPlus size={16} />}
onClick={() => agent.broadcast(events.add_new)}
variant="ghost"
/>
Expand Down Expand Up @@ -107,7 +119,7 @@ export default (props: IProps) => {
{show_history ? (
<IconButton
aria-label="Show history"
icon={<BiHistory />}
icon={<IconHistory size={16} />}
variant="ghost"
onClick={() => agent.broadcast(events.show_history)}
/>
Expand Down

0 comments on commit 6983a38

Please sign in to comment.