Skip to content

Commit

Permalink
feat: ux improvements
Browse files Browse the repository at this point in the history
Ux improvements - added scrollbar to logs, added active environment version
  • Loading branch information
lorow authored Aug 14, 2024
2 parents ec43ec0 + 8e1455b commit ba722e6
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
5 changes: 3 additions & 2 deletions src/components/Terminal/Firmware/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { Component } from 'solid-js'

export interface IProps {
version: string
board: string
}

const Firmware: Component<IProps> = (props) => {
return (
<div class="flex w-full flex-col gap-[6px] select-none">
<div class="flex w-full gap-[6px] select-none">
<p class="text-left not-italic font-[500] text-white leading-[14px] text-[16px]">
{props.version}
{props.version} {`${!props.board.trim() ? '' : `| ${props.board}`}`}
</p>
</div>
)
Expand Down
8 changes: 7 additions & 1 deletion src/containers/FlashFirmware/FlashFirmware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createEffect, createMemo, createSignal, onMount } from 'solid-js'
import { debug } from 'tauri-plugin-log-api'
import { ENotificationType, FLASH_STATUS, MODAL_TYPE } from '@interfaces/enums'
import Terminal from '@pages/Terminal/Index'
import { usb } from '@src/static'
import { BoardConnectionMethod, usb } from '@src/static'
import { download } from '@src/utils'
import { useAppAPIContext } from '@store/context/api'
import { useAppNotificationsContext } from '@store/context/notifications'
Expand Down Expand Up @@ -69,8 +69,14 @@ export const ManageFlashFirmware = () => {
}
})

const board = createMemo(() => {
const connectionMethod = BoardConnectionMethod[activeBoard().replace('_release', '')]
return connectionMethod ? `${activeBoard()} (${connectionMethod})` : activeBoard()
})

return (
<Terminal
board={board()}
isUSBBoard={isUSBBoard()}
percentageProgress={percentageProgress()}
logs={logs()}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Terminal/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface IProps {
isActiveProcess: boolean
firmwareVersion: string
isUSBBoard: boolean
board: string
}

const Terminal: Component<IProps> = (props) => {
Expand All @@ -43,7 +44,7 @@ const Terminal: Component<IProps> = (props) => {
</div>
<div class="flex flex-col overflow-hidden w-full h-full bg-[#00101C] p-[24px] rounded-[12px] gap-[12px]">
<div class="flex p-[12px] justify-between items-center">
<Firmware version={props.firmwareVersion} />
<Firmware version={props.firmwareVersion} board={props.board} />
</div>
<div
class="flex flex-col overflow-y-auto h-full w-full scrollbar"
Expand Down
2 changes: 2 additions & 0 deletions src/pages/VirtualList/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const VirtualList: Component<IProps> = (props) => {

return (
<div
class="scrollbarx scrollbar"
ref={(el) => (parentRef = el)}
style={{ height: height(), width: '100%', overflow: 'auto' }}>
<div
Expand All @@ -68,6 +69,7 @@ export const VirtualList: Component<IProps> = (props) => {
left: 0,
}}>
<pre
class="text-white"
style={{
'white-space': item.match(/\n/) ? 'nowrap' : 'none',
hyphens: 'none',
Expand Down
16 changes: 16 additions & 0 deletions src/static/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ export const BoardDescription: {
[BOARD_TYPE.XIAOSENSES_3_USB]: "SeedStudio's XIAO ESP32-S3 Sense (wired mode)",
}

export const BoardConnectionMethod: {
[key in BOARD_TYPE]: string
} = {
[BOARD_TYPE.ESP_32_AI_THINKER]: 'wireless mode',
[BOARD_TYPE.ESP_32]: 'wireless mode',
[BOARD_TYPE.ESP_32_M_5_STACK]: 'wireless mode',
[BOARD_TYPE.ESP_32_W_ROVER]: 'wireless mode',
[BOARD_TYPE.ESP_EYE]: 'wireless mode',
[BOARD_TYPE.WROOMS_3]: 'wireless mode',
[BOARD_TYPE.WROOMS_3_QIO]: 'wireless mode',
[BOARD_TYPE.WROOMS_3_USB]: 'wired mode',
[BOARD_TYPE.WROOMS_3QIOUSB]: 'wired mode',
[BOARD_TYPE.XIAOSENSES_3]: 'wireless mode',
[BOARD_TYPE.XIAOSENSES_3_USB]: 'wired mode',
}

export const ChannelOptions: Record<CHANNEL_TYPE, IChannelOptions> = {
[CHANNEL_TYPE.OFFICIAL]: {
label: CHANNEL_TYPE.OFFICIAL,
Expand Down
23 changes: 14 additions & 9 deletions src/styles/scrollbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@
border-radius: 12px;
}

.scrollbarx::-webkit-scrollbar {
width: 2px;
height: 4px;
.scrollbarx {
overflow-y: auto;
overflow-x: hidden;
}

/* Track */
.scrollbarx::-webkit-scrollbar-track {
border-radius: 10px;
.scrollbar::-webkit-scrollbar {
width: 6px;
}

/* Handle */
.scrollbarx::-webkit-scrollbar-thumb {
margin-left: 2px;
.scrollbarx::-webkit-scrollbar:horizontal {
height: 0px;
}

.scrollbarx::-webkit-scrollbar-thumb:vertical {
background: #9092ff;
border-radius: 12px;
}

.scrollbarx::-webkit-scrollbar-track:vertical {
border-radius: 10px;
}

0 comments on commit ba722e6

Please sign in to comment.