diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Logs.module.scss | 14 | ||||
| -rw-r--r-- | src/components/Logs.tsx | 9 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/components/Logs.module.scss b/src/components/Logs.module.scss index 87492c7..c90071d 100644 --- a/src/components/Logs.module.scss +++ b/src/components/Logs.module.scss @@ -25,6 +25,12 @@ } } +.levelSelect { + flex-shrink: 0; + width: auto; + min-width: 90px; +} + .clearBtn { background: none; border: none; @@ -35,7 +41,9 @@ display: flex; align-items: center; justify-content: center; - transition: background-color 0.2s, color 0.2s; + transition: + background-color 0.2s, + color 0.2s; &:hover { background-color: var(--bg-near-transparent); @@ -119,7 +127,9 @@ border-radius: 8px; color: var(--color-text); overflow-y: auto; - box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); + box-shadow: + 0 4px 6px -1px rgba(0, 0, 0, 0.1), + 0 2px 4px -1px rgba(0, 0, 0, 0.06); @media (max-width: 768px) { margin: 10px 15px; diff --git a/src/components/Logs.tsx b/src/components/Logs.tsx index 59abced..9baf3fa 100644 --- a/src/components/Logs.tsx +++ b/src/components/Logs.tsx @@ -4,11 +4,14 @@ import { useTranslation } from 'react-i18next'; import ContentHeader from '~/components/ContentHeader'; import LogSearch from '~/components/LogSearch'; +import Select from '~/components/shared/Select'; import { useStoreActions } from '~/components/StateProvider'; import SvgYacd from '~/components/SvgYacd'; import useRemainingViewPortHeight from '~/hooks/useRemainingViewPortHeight'; import { useLogsPage } from '~/modules/logs/hooks'; +import { LOG_LEVEL_OPTIONS } from '~/modules/config/utils'; import { LOG_TYPES, LOGS_HEIGHT_RATIO } from '~/modules/logs/utils'; +import { updateConfigs } from '~/store/configs'; import { clearLogs } from '~/store/logs'; import { DispatchFn, Log } from '~/store/types'; import { ClashAPIConfig } from '~/types'; @@ -58,6 +61,12 @@ export default function Logs({ dispatch, logLevel, apiConfig, logs, logStreaming <ContentHeader> <div className={s.headerControls}> <LogSearch className={s.searchWrapper} /> + <Select + className={s.levelSelect} + options={LOG_LEVEL_OPTIONS} + selected={logLevel ? logLevel.toLowerCase() : 'info'} + onChange={(e) => dispatch(updateConfigs(apiConfig, { 'log-level': e.target.value }))} + /> <button className={s.clearBtn} onClick={() => dispatch(clearLogs())} title={t('Clear')}> <Trash2 size={18} /> </button> |
