Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
562 changes: 331 additions & 231 deletions app/builder/[appId]/page.tsx

Large diffs are not rendered by default.

201 changes: 136 additions & 65 deletions app/globals.css

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions app/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ export default function NotFound() {
</div>
);
}

24 changes: 22 additions & 2 deletions components/builder/ConfigEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,30 @@ export function ConfigEditor({ value, onChange }: ConfigEditorProps) {
const { resolvedTheme } = useTheme();
const [mounted, setMounted] = useState(false);
const monacoRef = useRef<Monaco | null>(null);
const editorInstanceRef = useRef<Parameters<OnMount>[0] | null>(null);
const containerRef = useRef<HTMLDivElement>(null);

useEffect(() => {
setMounted(true);
}, []);

// Smooth throttled re-layout of Monaco editor during container / panel resize
useEffect(() => {
if (!containerRef.current) return;
let rafId: number;
const ro = new ResizeObserver(() => {
cancelAnimationFrame(rafId);
rafId = requestAnimationFrame(() => {
editorInstanceRef.current?.layout();
});
});
ro.observe(containerRef.current);
return () => {
cancelAnimationFrame(rafId);
ro.disconnect();
};
}, []);

const getCssColor = (varName: string, fallbackWithoutHash: string = "000000"): string => {
if (typeof window !== "undefined") {
const val = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
Expand Down Expand Up @@ -138,7 +157,8 @@ export function ConfigEditor({ value, onChange }: ConfigEditorProps) {
defineThemes(monaco);
};

const handleEditorDidMount: OnMount = (_editor, monaco) => {
const handleEditorDidMount: OnMount = (editor, monaco) => {
editorInstanceRef.current = editor;
monacoRef.current = monaco;
defineThemes(monaco);
const themeName = resolvedTheme === 'light' ? 'appforge-light' : 'appforge-dark';
Expand All @@ -163,7 +183,7 @@ export function ConfigEditor({ value, onChange }: ConfigEditorProps) {
const activeTheme = mounted && resolvedTheme === 'light' ? 'appforge-light' : 'appforge-dark';

return (
<div className="w-full h-full shrink-0 relative overflow-hidden" data-lenis-prevent>
<div ref={containerRef} className="w-full h-full shrink-0 relative overflow-hidden" data-lenis-prevent>
<Editor
height="100%"
defaultLanguage="json"
Expand Down
Loading
Loading