Merge pull request 'clean up crumbs of crunchy design' (#1942) from stylez into main

Reviewed-on: https://codeberg.org/uzu/strudel/pulls/1942
This commit is contained in:
froos
2026-01-22 22:15:01 +01:00
5 changed files with 31 additions and 51 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import Loader from '@src/repl/components/Loader';
import { HorizontalPanel } from '@src/repl/components/panel/Panel';
import { BottomPanel } from '@src/repl/components/panel/Panel';
import { Code } from '@src/repl/components/Code';
import BigPlayButton from '@src/repl/components/BigPlayButton';
import UserFacingErrorMessage from '@src/repl/components/UserFacingErrorMessage';
@@ -20,7 +20,7 @@ export default function UdelsEditor(Props) {
<Code containerRef={containerRef} editorRef={editorRef} init={init} />
</div>
<UserFacingErrorMessage error={error} />
<HorizontalPanel context={context} />
<BottomPanel context={context} />
</div>
);
}
+4 -4
View File
@@ -1,6 +1,6 @@
import { Code } from '@src/repl/components/Code';
import Loader from '@src/repl/components/Loader';
import { HorizontalPanel, MainPanel, VerticalPanel } from '@src/repl/components/panel/Panel';
import { BottomPanel, MainPanel, RightPanel } from '@src/repl/components/panel/Panel';
import UserFacingErrorMessage from '@src/repl/components/UserFacingErrorMessage';
import { useSettings } from '@src/settings.mjs';
@@ -21,13 +21,13 @@ export default function ReplEditor(Props) {
<div className="flex flex-col grow overflow-hidden">
{/* <MainPanel context={context} isEmbedded={isEmbedded} className="hidden sm:block" /> */}
<MainPanel context={context} isEmbedded={isEmbedded} />
<div className="flex overflow-hidden">
<div className="flex overflow-hidden h-full">
<Code containerRef={containerRef} editorRef={editorRef} init={init} />
{!isZen && panelPosition === 'right' && <VerticalPanel context={context} />}
{!isZen && panelPosition === 'right' && <RightPanel context={context} />}
</div>
</div>
<UserFacingErrorMessage error={error} />
{!isZen && panelPosition === 'bottom' && <HorizontalPanel context={context} />}
{!isZen && panelPosition === 'bottom' && <BottomPanel context={context} />}
{/* <MainPanel context={context} isEmbedded={isEmbedded} className="block sm:hidden" /> */}
</div>
);
@@ -2,13 +2,21 @@ import cx from '@src/cx.mjs';
import { useSettings } from '../../../settings.mjs';
import { useStore } from '@nanostores/react';
import { $strudel_log_history } from '../useLogger';
import { useEffect, useRef } from 'react';
export function ConsoleTab() {
const log = useStore($strudel_log_history);
const { fontFamily } = useSettings();
const scrollRef = useRef();
// scroll to bottom when log changes
useEffect(() => {
if (scrollRef.current) {
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
}
}, [log]);
return (
<div id="console-tab" className="break-all w-full h-full" style={{ fontFamily }}>
<div className="h-full w-full overflow-auto space-y-1 p-2 rounded-md">
<div className="h-full w-full overflow-auto space-y-1 p-2 rounded-md" ref={scrollRef}>
{' '}
{/* bg-background */}
{log.map((l, i) => {
@@ -18,12 +26,13 @@ export function ConsoleTab() {
<div
key={l.id}
className={cx(
'whitespace-nowrap',
l.type === 'error' ? 'text-background bg-foreground' : 'text-foreground',
l.type === 'highlight' && 'underline',
)}
style={color ? { color } : {}}
>
<span dangerouslySetInnerHTML={{ __html: message }} />
<span dangerouslySetInnerHTML={{ __html: message }} className="whitespace-nowrap" />
{l.count ? ` (${l.count})` : ''}
</div>
);
+13 -42
View File
@@ -48,11 +48,8 @@ export function MainPanel({ context, isEmbedded = false, className }) {
<nav
id="header"
className={cx(
//'border-t sm:border-b sm:border-t-0 border-muted',
'border-b border-muted',
'flex-none text-black z-[100] text-sm select-none min-h-10 max-h-10',
!isZen && !isEmbedded && 'bg-lineHighlight',
// isZen ? 'h-12 w-8 fixed top-0 left-0' : 'h-10 sticky top-0 w-full justify-between',
!isZen && !isEmbedded && 'border-b border-muted bg-lineHighlight',
isZen ? 'h-12 w-8 fixed top-0 left-0' : '',
'flex items-center',
className,
@@ -60,8 +57,6 @@ export function MainPanel({ context, isEmbedded = false, className }) {
style={{ fontFamily }}
>
<div className={cx('flex w-full justify-between')}>
{' '}
{/*flex-wrap*/}
<div className="px-3 py-1 flex space-x-2 select-none">
<h1
onClick={() => {
@@ -77,11 +72,6 @@ export function MainPanel({ context, isEmbedded = false, className }) {
<div className="space-x-2 flex items-baseline">
<span className="hidden sm:block">strudel</span>
<span className="text-sm font-medium hidden sm:block">REPL</span>
{/* !isEmbedded && isButtonRowHidden && (
<a href={`${baseNoTrailing}/learn`} className="text-sm opacity-25 font-medium">
DOCS
</a>
) */}
</div>
)}
</h1>
@@ -89,7 +79,6 @@ export function MainPanel({ context, isEmbedded = false, className }) {
{!isZen && (
<div className="flex grow justify-end">
{!isButtonRowHidden && <MainMenu isEmbedded={isEmbedded} context={context} />}
{/* className="hidden sm:flex" */}
<PanelToggle isEmbedded={isEmbedded} isZen={isZen} />
</div>
)}
@@ -101,7 +90,6 @@ export function MainPanel({ context, isEmbedded = false, className }) {
export function Footer({ context, isEmbedded = false }) {
return (
<div className="border-t border-muted bg-lineHighlight block lg:hidden">
{/* block lg:hidden */}
<MainMenu context={context} isEmbedded={isEmbedded} />
</div>
);
@@ -117,15 +105,10 @@ function MainMenu({ context, isEmbedded = false, className }) {
title={started ? 'stop' : 'play'}
className={cx('px-2 hover:opacity-50', !started && !isCSSAnimationDisabled && 'animate-pulse')}
>
{/* {!pending ? ( */}
<span className={cx('flex items-center space-x-2')}>
{/* {started ? <StopCircleIcon className="w-5 h-5" /> : <PlayCircleIcon className="w-5 h-5" />} */}
{started ? <StopIcon className="w-5 h-5" /> : <PlayIcon className="w-5 h-5" />}
{!isEmbedded && <span>{started ? 'stop' : 'play'}</span>}
{!isEmbedded && <span>{pending ? '...' : started ? 'stop' : 'play'}</span>}
</span>
{/* ) : (
<>loading...</>
)} */}
</button>
<button
onClick={handleEvaluate}
@@ -162,7 +145,7 @@ function PanelCloseButton() {
isPanelOpen && (
<button
onClick={() => setIsPanelOpened(false)}
className={cx('border-l border-muted px-2 py-0 text-foreground hover:opacity-50')}
className={cx('px-2 py-0 text-foreground hover:opacity-50')}
aria-label="Close Menu"
>
<XMarkIcon className="w-6 h-6" />
@@ -171,7 +154,7 @@ function PanelCloseButton() {
);
}
export function HorizontalPanel({ context }) {
export function BottomPanel({ context }) {
const { isPanelOpen, activeFooter: tab } = useSettings();
return (
<PanelNav
@@ -182,7 +165,7 @@ export function HorizontalPanel({ context }) {
>
<div className="flex justify-between min-h-10 max-h-10 grid-cols-2 items-center border-t border-muted">
<PanelCloseButton />
<Tabs setTab={setTab} tab={tab} />
<Tabs setTab={setTab} tab={tab} className={cx(isPanelOpen && 'border-l border-muted')} />
</div>
{isPanelOpen && (
<div className="w-full h-full overflow-auto border-t border-muted">
@@ -193,7 +176,7 @@ export function HorizontalPanel({ context }) {
);
}
export function VerticalPanel({ context }) {
export function RightPanel({ context }) {
const settings = useSettings();
const { activeFooter: tab, isPanelOpen } = settings;
if (!isPanelOpen) {
@@ -203,24 +186,16 @@ export function VerticalPanel({ context }) {
<PanelNav
settings={settings}
className={cx(
//'border-l border-muted shrink-0',
'border-0 border-muted shrink-0 h-full overflow-hidden',
isPanelOpen
? //? `min-w-full max-w-full lg:min-w-[min(600px,100vw)] lg:max-w-[min(600px,80vw)]`
`min-w-[min(600px,100vw)] max-w-[min(600px,80vw)]`
: 'min-w-12 max-w-12',
'border-l border-muted shrink-0 h-full overflow-hidden',
isPanelOpen ? `min-w-[min(600px,100vw)] max-w-[min(600px,80vw)]` : 'min-w-12 max-w-12',
)}
>
<div className={cx('flex flex-col h-full')}>
<div className="flex justify-between w-full overflow-hidden border-b border-muted min-h-10 max-h-10">
{/* <div className="block sm:hidden text-foreground px-3 py-2 border-l border-muted">
<LogoButton context={context} />
</div> */}
<PanelCloseButton />
<Tabs setTab={setTab} tab={tab} />
{/* <PanelCloseButton /> */}
<Tabs setTab={setTab} tab={tab} className="border-l border-muted" />
</div>
<div className="overflow-auto h-full border-l border-muted">
<div className="overflow-auto h-full">
<PanelContent context={context} tab={tab} />
</div>
</div>
@@ -301,7 +276,7 @@ function Tabs({ className }) {
return (
<div
className={cx(
'px-2 border-l border-muted w-full flex select-none max-w-full h-10 max-h-10 min-h-10 overflow-auto items-center',
'px-2 w-full flex select-none max-w-full h-10 max-h-10 min-h-10 overflow-auto items-center',
className,
)}
>
@@ -320,14 +295,10 @@ export function PanelToggle({ isEmbedded, isZen }) {
!isZen &&
panelPosition === 'right' && (
<button
title="share"
className={cx(
'border-l border-muted px-2 py-0 text-foreground hover:opacity-50' /* , isPanelOpen && 'hidden' */,
)}
title="menu"
className={cx('border-l border-muted px-2 py-0 text-foreground hover:opacity-50')}
onClick={() => setIsPanelOpened(!isPanelOpen)}
>
{/* <span>menu</span> */}
{/* isPanelOpen ? <XMarkIcon className="w-6 h-6" /> : <Bars3Icon className="w-6 h-6" /> */}
<Bars3Icon className="w-6 h-6" />
</button>
)
+1 -1
View File
@@ -21,7 +21,7 @@ function getUpdatedLog(log, event) {
} else {
log = log.concat([{ message, type, id, data }]);
}
return log.slice(-20);
return log.slice(-40);
}
export function useLogger() {