forked from MetaCubeX/metacubexd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
342 additions
and
216 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { children, ParentComponent } from 'solid-js' | ||
|
||
export const ConfigTitle: ParentComponent<{ withDivider?: boolean }> = ( | ||
props, | ||
) => ( | ||
<div | ||
class="pb-4 text-lg font-semibold" | ||
classList={{ | ||
divider: props.withDivider, | ||
}} | ||
> | ||
{children(() => props.children)()} | ||
</div> | ||
) |
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,81 @@ | ||
import { useI18n } from '@solid-primitives/i18n' | ||
import { For } from 'solid-js' | ||
import { ConfigTitle } from '~/components' | ||
import { | ||
LOG_LEVEL, | ||
LOGS_TABLE_MAX_ROWS_LIST, | ||
MODAL, | ||
TAILWINDCSS_SIZE, | ||
} from '~/constants' | ||
import { | ||
logMaxRows, | ||
logsTableSize, | ||
setLogLevel, | ||
setLogMaxRows, | ||
setLogsTableSize, | ||
} from '~/signals' | ||
|
||
export const LogsSettingsModal = () => { | ||
const [t] = useI18n() | ||
|
||
return ( | ||
<dialog id={MODAL.LOGS_SETTINGS} class="modal modal-bottom sm:modal-middle"> | ||
<div class="modal-box flex flex-col gap-4"> | ||
<div> | ||
<ConfigTitle withDivider>{t('tableSize')}</ConfigTitle> | ||
|
||
<select | ||
class="select select-bordered w-full" | ||
value={logsTableSize()} | ||
onChange={(e) => | ||
setLogsTableSize(e.target.value as TAILWINDCSS_SIZE) | ||
} | ||
> | ||
<For each={Object.values(TAILWINDCSS_SIZE)}> | ||
{(value) => <option value={value}>{t(value)}</option>} | ||
</For> | ||
</select> | ||
</div> | ||
|
||
<div> | ||
<ConfigTitle withDivider>{t('logLevel')}</ConfigTitle> | ||
|
||
<select | ||
class="select select-bordered w-full" | ||
onChange={(e) => setLogLevel(e.target.value as LOG_LEVEL)} | ||
> | ||
<For | ||
each={[ | ||
LOG_LEVEL.Info, | ||
LOG_LEVEL.Error, | ||
LOG_LEVEL.Warning, | ||
LOG_LEVEL.Debug, | ||
LOG_LEVEL.Silent, | ||
]} | ||
> | ||
{(level) => <option value={level}>{t(level)}</option>} | ||
</For> | ||
</select> | ||
</div> | ||
|
||
<div> | ||
<ConfigTitle withDivider>{t('logMaxRows')}</ConfigTitle> | ||
|
||
<select | ||
class="select select-bordered w-full" | ||
value={logMaxRows()} | ||
onChange={(e) => setLogMaxRows(parseInt(e.target.value))} | ||
> | ||
<For each={LOGS_TABLE_MAX_ROWS_LIST}> | ||
{(rows) => <option value={rows}>{rows}</option>} | ||
</For> | ||
</select> | ||
</div> | ||
</div> | ||
|
||
<form method="dialog" class="modal-backdrop"> | ||
<button /> | ||
</form> | ||
</dialog> | ||
) | ||
} |
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,107 @@ | ||
import { useI18n } from '@solid-primitives/i18n' | ||
import { For } from 'solid-js' | ||
import { ConfigTitle } from '~/components' | ||
import { MODAL, PROXIES_ORDERING_TYPE, PROXIES_PREVIEW_TYPE } from '~/constants' | ||
import { | ||
autoCloseConns, | ||
latencyTestTimeoutDuration, | ||
proxiesOrderingType, | ||
proxiesPreviewType, | ||
setAutoCloseConns, | ||
setLatencyTestTimeoutDuration, | ||
setProxiesOrderingType, | ||
setProxiesPreviewType, | ||
setUrlForLatencyTest, | ||
urlForLatencyTest, | ||
} from '~/signals' | ||
|
||
export const ProxiesSettingsModal = () => { | ||
const [t] = useI18n() | ||
|
||
return ( | ||
<dialog | ||
id={MODAL.PROXIES_SETTINGS} | ||
class="modal modal-bottom sm:modal-middle" | ||
> | ||
<div class="modal-box flex flex-col gap-4"> | ||
<div> | ||
<ConfigTitle withDivider>{t('autoCloseConns')}</ConfigTitle> | ||
|
||
<div class="flex w-full justify-center"> | ||
<input | ||
class="toggle" | ||
type="checkbox" | ||
checked={autoCloseConns()} | ||
onChange={(e) => setAutoCloseConns(e.target.checked)} | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div class="flex flex-col"> | ||
<ConfigTitle withDivider>{t('urlForLatencyTest')}</ConfigTitle> | ||
|
||
<input | ||
class="input input-bordered w-full" | ||
value={urlForLatencyTest()} | ||
onChange={(e) => setUrlForLatencyTest(e.target.value)} | ||
/> | ||
</div> | ||
|
||
<div> | ||
<ConfigTitle withDivider> | ||
{t('latencyTestTimeoutDuration')} ({t('ms')}) | ||
</ConfigTitle> | ||
|
||
<input | ||
type="number" | ||
class="input input-bordered w-full" | ||
value={latencyTestTimeoutDuration()} | ||
onChange={(e) => | ||
setLatencyTestTimeoutDuration(Number(e.target.value)) | ||
} | ||
/> | ||
</div> | ||
|
||
<div> | ||
<ConfigTitle withDivider>{t('proxiesSorting')}</ConfigTitle> | ||
|
||
<select | ||
class="select select-bordered w-full" | ||
value={proxiesOrderingType()} | ||
onChange={(e) => | ||
setProxiesOrderingType(e.target.value as PROXIES_ORDERING_TYPE) | ||
} | ||
> | ||
<For each={Object.values(PROXIES_ORDERING_TYPE)}> | ||
{(value) => ( | ||
<option class="flex items-center gap-2" value={value}> | ||
{t(value)} | ||
</option> | ||
)} | ||
</For> | ||
</select> | ||
</div> | ||
|
||
<div> | ||
<ConfigTitle withDivider>{t('proxiesPreviewType')}</ConfigTitle> | ||
|
||
<select | ||
class="select select-bordered w-full" | ||
value={proxiesPreviewType()} | ||
onChange={(e) => | ||
setProxiesPreviewType(e.target.value as PROXIES_PREVIEW_TYPE) | ||
} | ||
> | ||
<For each={Object.values(PROXIES_PREVIEW_TYPE)}> | ||
{(value) => <option value={value}>{t(value)}</option>} | ||
</For> | ||
</select> | ||
</div> | ||
</div> | ||
|
||
<form method="dialog" class="modal-backdrop"> | ||
<button /> | ||
</form> | ||
</dialog> | ||
) | ||
} |
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
Oops, something went wrong.