fix: server log actions position (#4608)

* fix: sever log actions position

* chore: unused import
This commit is contained in:
Faisal Amir 2025-02-09 13:07:08 +07:00 committed by GitHub
parent c5f17b4e83
commit a9a63ab5d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 201 additions and 199 deletions

View File

@ -93,14 +93,8 @@ const ServerLogs = (props: ServerLogsProps) => {
}, [listRef.current?.scrollHeight, isUserManuallyScrollingUp, logs]) }, [listRef.current?.scrollHeight, isUserManuallyScrollingUp, logs])
return ( return (
<ScrollArea <>
ref={listRef} <div>
className={twMerge(
'h-[calc(100%-49px)] w-full p-4 py-0',
logs.length === 0 && 'mx-auto'
)}
onScroll={handleScroll}
>
{withCopy && ( {withCopy && (
<div className="absolute right-2 top-7"> <div className="absolute right-2 top-7">
<div className="flex w-full flex-row gap-2"> <div className="flex w-full flex-row gap-2">
@ -140,6 +134,15 @@ const ServerLogs = (props: ServerLogsProps) => {
</div> </div>
</div> </div>
)} )}
</div>
<ScrollArea
ref={listRef}
className={twMerge(
'h-[calc(100%-49px)] w-full p-4 py-0',
logs.length === 0 && 'mx-auto'
)}
onScroll={handleScroll}
>
<div className="flex h-full w-full flex-col"> <div className="flex h-full w-full flex-col">
{logs.length > 0 ? ( {logs.length > 0 ? (
<code className="inline-block max-w-[38vw] whitespace-break-spaces text-[13px] lg:max-w-[40vw] xl:max-w-[50vw]"> <code className="inline-block max-w-[38vw] whitespace-break-spaces text-[13px] lg:max-w-[40vw] xl:max-w-[50vw]">
@ -155,7 +158,7 @@ const ServerLogs = (props: ServerLogsProps) => {
<div <div
className={twMerge( className={twMerge(
'mt-24 flex w-full flex-col items-center justify-center', 'mt-24 flex w-full flex-col items-center justify-center',
withCopy && 'mt-0 py-2' withCopy && 'mt-4 py-2'
)} )}
> >
<svg <svg
@ -287,11 +290,14 @@ const ServerLogs = (props: ServerLogsProps) => {
</linearGradient> </linearGradient>
</defs> </defs>
</svg> </svg>
<p className="text-[hsla(var(--text-secondary)] mt-4">Empty logs</p> <p className="text-[hsla(var(--text-secondary)] mt-4">
Empty logs
</p>
</div> </div>
)} )}
</div> </div>
</ScrollArea> </ScrollArea>
</>
) )
} }

View File

@ -2,9 +2,6 @@ import { EngineManager, InferenceEngine } from '@janhq/core'
import { useAtomValue, useSetAtom } from 'jotai' import { useAtomValue, useSetAtom } from 'jotai'
import ErrorMessage from '@/containers/ErrorMessage' import ErrorMessage from '@/containers/ErrorMessage'
import ModalTroubleShooting, {
modalTroubleShootingAtom,
} from '@/containers/ModalTroubleShoot'
import { MainViewState } from '@/constants/screens' import { MainViewState } from '@/constants/screens'
@ -15,7 +12,6 @@ import { activeAssistantAtom } from '@/helpers/atoms/Assistant.atom'
import { selectedSettingAtom } from '@/helpers/atoms/Setting.atom' import { selectedSettingAtom } from '@/helpers/atoms/Setting.atom'
const LoadModelError = () => { const LoadModelError = () => {
const setModalTroubleShooting = useSetAtom(modalTroubleShootingAtom)
const loadModelError = useAtomValue(loadModelErrorAtom) const loadModelError = useAtomValue(loadModelErrorAtom)
const setMainState = useSetAtom(mainViewStateAtom) const setMainState = useSetAtom(mainViewStateAtom)
const setSelectedSettingScreen = useSetAtom(selectedSettingAtom) const setSelectedSettingScreen = useSetAtom(selectedSettingAtom)