Redesign transformer workbench UI

This commit is contained in:
Ritesh Kumar committed 2026-09-29 02:07:05 +05:30
1 parent 5637ec2cd6
commit de5b62b827
9 files changed
+865 -228

No files matched your search

+164 -87
View File
@@ -1,37 +1,39 @@
import React, { useEffect } from "react";
import { Button, IconButton, Pane, Tooltip } from "evergreen-ui";
import React, { useEffect, useRef, useState } from "react";
import {
Link,
Outlet,
useNavigate,
useRouterState
} from "@tanstack/react-router";
import NProgress from "nprogress";
import Navigator from "@components/Navigator";
import { activeRouteData, routes } from "@utils/routes";
import "@styles/main.css";
import NProgress from "nprogress";
import { Outlet, useRouterState } from "@tanstack/react-router";
import { useDarkMode } from "@hooks/useDarkMode";
const logo = (
<svg
xmlns="http://www.w3.org/2000/svg"
width="90px"
height="19px"
viewBox="0 0 306 62"
style={{
marginTop: -4
}}
>
<path
fill="#fff"
fillRule="nonzero"
stroke="none"
strokeWidth={1}
d="M172.339 71.14V98h-7.91V71.14h-3.376v-7.382h3.375V51.207h7.91v12.55h6.153v7.384h-6.152zm11.989-7.382h7.91v3.058c1.453-1.523 2.742-2.566 3.867-3.129 1.149-.585 2.508-.878 4.078-.878 2.086 0 4.266.68 6.54 2.039L203.1 72.09c-1.5-1.078-2.964-1.617-4.394-1.617-4.313 0-6.469 3.257-6.469 9.773V98h-7.91V63.758zm52.138 0h7.945V98h-7.945v-3.586c-3.258 3.047-6.762 4.57-10.512 4.57-4.734 0-8.648-1.71-11.742-5.132-3.07-3.493-4.606-7.852-4.606-13.079 0-5.132 1.536-9.41 4.606-12.832 3.07-3.421 6.914-5.132 11.531-5.132 3.985 0 7.559 1.64 10.723 4.921v-3.972zm-18.774 17.015c0 3.282.88 5.954 2.637 8.016 1.805 2.086 4.078 3.129 6.82 3.129 2.93 0 5.297-1.008 7.102-3.023 1.805-2.086 2.707-4.735 2.707-7.946 0-3.21-.902-5.86-2.707-7.945-1.805-2.04-4.148-3.059-7.031-3.059-2.719 0-4.992 1.032-6.82 3.094-1.805 2.086-2.708 4.664-2.708 7.734zm37.162-17.015h7.945v3.164c2.766-2.742 5.883-4.113 9.352-4.113 3.984 0 7.09 1.253 9.316 3.761 1.922 2.133 2.883 5.614 2.883 10.442V98h-7.945V78.875c0-3.375-.47-5.707-1.407-6.996-.914-1.313-2.578-1.969-4.992-1.969-2.625 0-4.488.867-5.59 2.602-1.078 1.71-1.617 4.699-1.617 8.965V98h-7.945V63.758zm59.837 5.836l-6.54 3.48c-1.03-2.11-2.308-3.164-3.831-3.164-.727 0-1.348.24-1.864.72-.515.481-.773 1.097-.773 1.847 0 1.312 1.523 2.613 4.57 3.902 4.196 1.805 7.02 3.469 8.473 4.992 1.453 1.524 2.18 3.574 2.18 6.152 0 3.305-1.22 6.07-3.657 8.297-2.367 2.11-5.226 3.164-8.578 3.164-5.742 0-9.808-2.8-12.199-8.402l6.75-3.129c.938 1.64 1.652 2.684 2.145 3.129.96.89 2.109 1.336 3.445 1.336 2.672 0 4.008-1.219 4.008-3.656 0-1.407-1.032-2.719-3.094-3.938-.797-.398-1.594-.785-2.39-1.16-.798-.375-1.606-.762-2.426-1.16-2.297-1.125-3.914-2.25-4.852-3.375-1.195-1.43-1.793-3.27-1.793-5.52 0-2.976 1.02-5.437 3.059-7.382 2.086-1.946 4.617-2.918 7.593-2.918 4.383 0 7.641 2.261 9.774 6.785zm17.966 1.547V98h-7.945V71.14h-2.813v-7.382h2.813V50.539c0-4.312.75-7.36 2.25-9.14 2.062-2.485 5.062-3.727 9-3.727 1.406 0 3.175.41 5.308 1.23v8.086l-.808-.422c-1.711-.867-3.118-1.3-4.22-1.3-1.405 0-2.355.504-2.847 1.511-.492.985-.738 2.883-.738 5.696v11.285h8.613v7.383h-8.613zm12.903 9.492c0-4.946 1.77-9.153 5.309-12.621 3.539-3.469 7.851-5.203 12.937-5.203 5.11 0 9.446 1.746 13.008 5.238 3.516 3.492 5.274 7.781 5.274 12.867 0 5.133-1.77 9.434-5.309 12.902-3.562 3.446-7.933 5.168-13.113 5.168-5.133 0-9.434-1.757-12.903-5.273-3.468-3.469-5.203-7.828-5.203-13.078zm8.086.14c0 3.422.914 6.13 2.742 8.122 1.875 2.015 4.348 3.023 7.418 3.023 3.094 0 5.567-.996 7.418-2.988 1.852-1.993 2.778-4.653 2.778-7.98 0-3.329-.926-5.99-2.778-7.981-1.875-2.016-4.347-3.024-7.418-3.024-3.023 0-5.472 1.008-7.347 3.024-1.875 2.015-2.813 4.617-2.813 7.804zm37.267-17.015h7.91v3.058c1.453-1.523 2.742-2.566 3.867-3.129 1.149-.585 2.508-.878 4.079-.878 2.085 0 4.265.68 6.539 2.039l-3.622 7.242c-1.5-1.078-2.964-1.617-4.394-1.617-4.313 0-6.469 3.257-6.469 9.773V98h-7.91V63.758zm28.478 0h7.91v3.164c1.523-1.594 2.824-2.672 3.902-3.234 1.149-.586 2.59-.88 4.324-.88 3.868 0 6.926 1.688 9.176 5.063 2.485-3.375 5.848-5.062 10.09-5.062 7.711 0 11.566 4.675 11.566 14.027V98h-7.945V78.98c0-3.28-.398-5.601-1.195-6.96-.82-1.383-2.168-2.075-4.043-2.075-2.18 0-3.768.82-4.764 2.461-.996 1.64-1.494 4.278-1.494 7.91V98h-7.945V79.086c0-6.094-1.758-9.14-5.274-9.14-2.226 0-3.85.831-4.869 2.495-1.02 1.664-1.53 4.29-1.53 7.875V98h-7.91V63.758z"
transform="translate(-161 -37)"
/>
</svg>
);
function Icon({ name }: { name: string }) {
return (
<span className="material-symbols-outlined" aria-hidden="true">
{name}
</span>
);
}
export default function AppShell() {
const { isDarkMode, toggleDarkMode } = useDarkMode();
const [sidebarOpen, setSidebarOpen] = useState(
() =>
typeof window !== "undefined" &&
window.matchMedia("(min-width: 601px)").matches
);
const [paletteOpen, setPaletteOpen] = useState(false);
const [query, setQuery] = useState("");
const searchRef = useRef<HTMLInputElement>(null);
const navigate = useNavigate();
const isLoading = useRouterState({ select: state => state.isLoading });
const pathname = useRouterState({ select: state => state.location.pathname });
const active = activeRouteData(pathname);
const matches = routes.filter(route =>
route.searchTerm.toLowerCase().includes(query.toLowerCase())
);
useEffect(() => {
if (!isLoading) {
@@ -45,69 +47,144 @@ export default function AppShell() {
};
}, [isLoading]);
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {
event.preventDefault();
setPaletteOpen(open => !open);
} else if (
(event.metaKey || event.ctrlKey) &&
event.key.toLowerCase() === "b"
) {
event.preventDefault();
setSidebarOpen(open => !open);
} else if (event.key === "Escape") setPaletteOpen(false);
};
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
}, []);
useEffect(() => {
if (paletteOpen) searchRef.current?.focus();
else setQuery("");
}, [paletteOpen]);
return (
<>
<Pane
display="flex"
alignItems="center"
flexDirection="row"
is="header"
height={40}
backgroundColor="#0e7ccf"
paddingRight={20}
>
<Pane flex={1} display="flex" paddingX={20} className="logo-transform">
{logo}
</Pane>
<Pane display="flex" alignItems={"center"}>
<Tooltip content="Toggle dark mode">
<IconButton
height={20}
marginRight={10}
icon="moon"
onClick={toggleDarkMode}
/>
</Tooltip>
</Pane>
<Pane display="flex" alignItems={"center"}>
<a
style={{
display: "inline-block",
height: 20
}}
href="https://github.com/ritz078/transform"
<div className="app-shell">
<header className="app-header">
<div className="header-start">
<button
className="icon-button sidebar-toggle"
type="button"
onClick={() => setSidebarOpen(open => !open)}
aria-label="Toggle sidebar"
title="Toggle sidebar (Ctrl+B)"
>
<img
src="https://img.shields.io/github/stars/ritz078/transform?style=social"
alt=""
/>
<Icon name="dock_to_left" />
</button>
<Link to="/" className="brand">
transform <span>tools</span>
</Link>
<span className="header-divider">/</span>
<button
className="route-switcher"
type="button"
onClick={() => setPaletteOpen(true)}
aria-label="Switch transformer"
>
<strong>{active?.category || "SVG"}</strong>
<span>→</span>
<strong className="route-target">
{active?.label?.replace(/^to /, "") || "JSX"}
</strong>
<Icon name="expand_more" />
<kbd>⌘K</kbd>
</button>
</div>
<div className="header-actions">
<a
className="icon-button"
href="https://github.com/ritz078/transform"
target="_blank"
rel="noreferrer"
aria-label="GitHub"
title="GitHub"
>
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
</a>
<a href="https://github.com/ritz078/transform" target="_blank">
<Button
appearance="minimal"
height={40}
css={{
color: "#fff !important"
}}
>
GitHub
</Button>
</a>
</Pane>
</Pane>
<Pane
backgroundColor="#FFFFFF"
className={isDarkMode ? "dark" : "light"}
display="flex"
flexDirection="row"
>
<Navigator />
<React.Fragment key={pathname}>
</div>
</header>
<div className="app-workspace">
{sidebarOpen && <Navigator />}
<main className="workspace-main" key={pathname}>
<Outlet />
</React.Fragment>
</Pane>
</>
</main>
</div>
{paletteOpen && (
<div
className="palette-backdrop"
onMouseDown={() => setPaletteOpen(false)}
>
<div
className="command-palette"
role="dialog"
aria-modal="true"
aria-label="Switch transformer"
onMouseDown={event => event.stopPropagation()}
>
<div className="palette-search">
<Icon name="search" />
<input
ref={searchRef}
value={query}
onChange={event => setQuery(event.target.value)}
onKeyDown={event => {
if (event.key === "Enter" && matches[0]) {
navigate({ to: matches[0].path });
setPaletteOpen(false);
}
}}
placeholder="Search converters (e.g. svg to jsx, json to typescript)..."
aria-label="Search converters"
/>
<kbd>ESC</kbd>
</div>
<div className="palette-results">
<div className="palette-heading">
{query ? "Results" : "Featured transformers"}
</div>
{matches.slice(0, 12).map(route => (
<button
type="button"
key={route.path}
className={`palette-result ${
pathname === route.path ? "active" : ""
}`}
onClick={() => {
navigate({ to: route.path });
setPaletteOpen(false);
}}
>
<Icon name="polyline" />
<span>{route.searchTerm}</span>
<small>{route.category}</small>
</button>
))}
{matches.length === 0 && (
<p className="palette-empty">No matching converters</p>
)}
</div>
<div className="palette-footer">
<span>
Press <kbd>↵</kbd> to open the first result
</span>
<span>{routes.length} developer tools</span>
</div>
</div>
</div>
)}
</div>
);
}
+9 -2
View File
@@ -119,13 +119,15 @@ const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function(
return (
<>
<Pane
className="conversion-workspace"
display="flex"
flexDirection="row"
overflow="hidden"
flex={1}
height={"calc(100vh - 40px)"}
height={"100%"}
>
<Pane
className="conversion-input-column"
display="flex"
flex={1}
borderRight
@@ -161,7 +163,12 @@ const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function(
</Pane>
)}
</Pane>
<Pane display="flex" flex={1} position="relative">
<Pane
className="conversion-output-column"
display="flex"
flex={1}
position="relative"
>
{showUpdateSpinner && (
<Pane
display="inline-flex"
+82 -21
View File
@@ -13,7 +13,6 @@ import {
import React, { useCallback, useEffect, useRef, useState } from "react";
import { lazy, Suspense } from "react";
import copy from "clipboard-copy";
import Npm from "@assets/svgs/Npm";
import { useDropzone } from "react-dropzone";
export interface EditorPanelProps {
@@ -56,17 +55,21 @@ export default function EditorPanel({
defaultValue,
onChange,
id,
packageDetails
packageDetails: _packageDetails
}: EditorPanelProps) {
const [showSettingsDialogue, setSettingsDialog] = useState(false);
const [value, setValue] = useState(defaultValue);
const [fetchingUrl, setFetchingUrl] = useState("");
const [copied, setCopied] = useState(false);
const options = {
fontSize: 14,
fontSize: 12.5,
readOnly: !editable,
codeLens: false,
fontFamily: "Menlo, Consolas, monospace, sans-serif",
fontFamily: "JetBrains Mono, Menlo, Consolas, monospace",
lineHeight: 24,
padding: { top: 6, bottom: 6 },
scrollBeyondLastLine: false,
minimap: {
enabled: false
},
@@ -125,11 +128,29 @@ export default function EditorPanel({
const copyValue = useCallback(() => {
copy(value);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
toaster.success("Copied to clipboard.", {
id
});
}, [value]);
const downloadValue = useCallback(() => {
const file = new Blob([value], { type: "text/plain" });
const url = URL.createObjectURL(file);
const link = document.createElement("a");
link.href = url;
link.download = `transform-output.${
language === "typescript"
? "ts"
: language === "javascript"
? "jsx"
: language || "txt"
}`;
link.click();
URL.revokeObjectURL(url);
}, [value, language]);
const fetchFile = useCallback(
close => {
(async () => {
@@ -151,8 +172,15 @@ export default function EditorPanel({
}, [defaultValue]);
return (
<Pane display="flex" flex={1} flexDirection="column" overflow="hidden">
<Pane
className={`editor-panel ${editable ? "input-panel" : "output-panel"}`}
display="flex"
flex={1}
flexDirection="column"
overflow="hidden"
>
<Pane
className="editor-header"
display="flex"
height={40}
paddingX={10}
@@ -162,7 +190,11 @@ export default function EditorPanel({
backgroundColor="#FFFFFF"
flexShrink={0}
>
<Pane flex={1}>
<Pane flex={1} className="editor-heading">
<span className="editor-heading-label">
{editable ? "Input" : "Output"}
</span>
<span className="editor-heading-slash">/</span>
<Heading size={500} marginTop={0}>
{title}
</Heading>
@@ -229,34 +261,35 @@ export default function EditorPanel({
icon="trash"
intent="danger"
marginRight={10}
onClick={() => setValue("")}
onClick={() => {
setValue("");
onChange?.("");
}}
/>
</Tooltip>
)}
{packageDetails && (
<a
href={packageDetails.url}
style={{
display: "inline-flex"
}}
target="_blank"
>
<Tooltip content={packageDetails.name}>
<Npm />
</Tooltip>
</a>
{!editable && (
<Tooltip content="Download output">
<IconButton
className="editor-download-button"
height={28}
icon="download"
onClick={downloadValue}
/>
</Tooltip>
)}
{hasCopy && (
<Button
className="editor-copy-button"
appearance="primary"
marginRight={10}
iconBefore="duplicate"
iconBefore={copied ? "tick" : "duplicate"}
onClick={copyValue}
height={28}
>
Copy
{copied ? "Copied!" : "Copy"}
</Button>
)}
</Pane>
@@ -288,6 +321,34 @@ export default function EditorPanel({
/>
</Suspense>
</div>
<div className="editor-footer">
<span>
{editable
? `Source • ${new Blob([value]).size} B`
: `Target • ${language || "text"}`}
{!editable && _packageDetails && (
<>
{" "}
·{" "}
<a
href={_packageDetails.url}
target="_blank"
rel="noreferrer"
title={`Powered by ${_packageDetails.name}`}
>
{_packageDetails.name}
</a>
</>
)}
</span>
<span>
{editable
? value
? "Ready to transform"
: "Empty input"
: "Generated output"}
</span>
</div>
</Pane>
);
}
+52 -90
View File
@@ -1,100 +1,62 @@
import React, { Fragment } from "react";
import { Heading, Pane, Text } from "evergreen-ui";
import { categorizedRoutes, Route } from "@utils/routes";
import React, { useState } from "react";
import { Link, useRouterState } from "@tanstack/react-router";
import SearchBox from "@components/Searchbox";
import { categorizedRoutes, routes } from "@utils/routes";
export default function Navigator() {
const pathname = useRouterState({ select: state => state.location.pathname });
const [filter, setFilter] = useState("");
return (
<Pane
width={240}
height={"calc(100vh - 40px)"}
borderRight
display="flex"
flexDirection="column"
paddingTop={20}
backgroundColor="#FFFFFF"
>
<Pane paddingX={15}>
<SearchBox />
</Pane>
<Pane
display="flex"
flex={1}
overflowY="scroll"
flexDirection="column"
paddingBottom={10}
>
{categorizedRoutes.map(route => {
<aside className="workbench-sidebar" aria-label="Transformers">
<div className="sidebar-search">
<span className="material-symbols-outlined" aria-hidden="true">
search
</span>
<input
value={filter}
onChange={event => setFilter(event.target.value)}
placeholder="Filter transformers..."
aria-label="Filter transformers"
/>
</div>
<nav className="sidebar-list">
{categorizedRoutes.map(group => {
const items = group.content.filter(item =>
`${group.category} ${item.label}`
.toLowerCase()
.includes(filter.toLowerCase())
);
if (!items.length) return null;
return (
<Fragment key={route.category}>
<Pane paddingX={10} marginTop={15} marginBottom={2}>
<Heading marginLeft={5} size={400}>
{route.category}
</Heading>
</Pane>
{(route.content as Route[])
.sort((a, b) => a.label.localeCompare(b.label))
.map((a: Route) => {
const isActive = pathname === a.path;
return (
<Link
key={a.label}
to={a.path}
preload={false}
style={{ textDecoration: "none" }}
>
<Pane
paddingLeft={16}
paddingY={3}
backgroundColor={isActive ? "#f3f3f3" : undefined}
borderLeft={
isActive
? "3px solid #009688"
: "3px solid transparent"
}
css={{
"&:hover": {
backgroundColor: "#f5f5f5"
}
}}
>
<Text fontSize={13}>{a.label}</Text>
</Pane>
</Link>
);
})}
</Fragment>
<div className="sidebar-group" key={group.category}>
<div className="sidebar-group-title">
<span>{group.category}</span>
<span>{items.length}</span>
</div>
<div className="sidebar-group-items">
{items.map(item => (
<Link
key={item.path}
to={item.path}
preload={false}
className={`sidebar-link ${
pathname === item.path ? "active" : ""
}`}
>
<span className="sidebar-link-dot" />
{group.category === "Others"
? item.label
: `${group.category} ${item.label}`}
</Link>
))}
</div>
</div>
);
})}
</Pane>
<Pane borderTop>
<a
href="https://vercel.com?utm_source=ritz078&utm_campaign=oss"
target="_blank"
>
<img
src="https://www.datocms-assets.com/31049/1618983297-powered-by-vercel.svg"
alt="Vercel"
style={{
height: 40,
display: "block",
margin: "10px auto 0"
}}
/>
</a>
<Heading size={400} paddingY={15} textAlign="center">
Created by{" "}
<a href="https://twitter.com/ritz078" target="_blank">
@ritz078
</a>
</Heading>
</Pane>
</Pane>
</nav>
<div className="sidebar-footer">
<span>{routes.length} Converters</span>
<span>v2.0.2</span>
</div>
</aside>
);
}
+1 -22
View File
@@ -3,7 +3,7 @@ import { default as React, useCallback } from "react";
import { EditorPanelProps } from "@components/EditorPanel";
import Form from "@components/Form";
import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import { Alert, Badge, Heading, Pane } from "evergreen-ui";
import { Badge, Pane } from "evergreen-ui";
const svgToDataUrl = (svgStr: string) => {
const encoded = encodeURIComponent(svgStr)
@@ -61,27 +61,6 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
settings={settings}
editorProps={{
settingElement: getSettingsPanel,
topNotifications: ({ toggleSettings }) =>
settings.optimizeSvg && (
<Alert
intent="warning"
backgroundColor="#FEF8E7"
title={
<>
SVGO optimization is turned on. You can turn it off or
configure it in{" "}
<Heading
size={400}
is="a"
color={"blue"}
onClick={toggleSettings}
>
settings
</Heading>
</>
}
/>
),
previewElement: value => (
<Pane display="flex" flexDirection="row" flex={1}>
<Pane display={"flex"} flex={1} position="relative">
+3 -4
View File
@@ -16,10 +16,9 @@ export const html = `<!-- Hello world -->
</div>
<p>Enter your HTML here</p>`;
export const svg = `<svg style="flex:1;" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="10" y="10" height="100" width="100"
style="stroke:#ff0000; fill: #0000ff"/>
export const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<rect x="2" y="2" width="20" height="20" rx="4" fill="none" stroke="#0E7CCF" stroke-width="2"/>
<path d="M7 12l3 3 7-7" stroke="#10B981" stroke-width="2" stroke-linecap="round"/>
</svg>`;
export const css = `.main-wrapper {
+14 -1
View File
@@ -24,6 +24,17 @@ export const Route = createRootRoute({
],
links: [
{ rel: "stylesheet", href: stylesheet },
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
{
rel: "preconnect",
href: "https://fonts.gstatic.com",
crossOrigin: "anonymous"
},
{
rel: "stylesheet",
href:
"https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Material+Symbols+Outlined:wght@100..700&display=swap"
},
{ rel: "icon", href: "/static/favicon.png", type: "image/png" },
{ rel: "manifest", href: "/static/site.webmanifest" }
]
@@ -66,7 +77,9 @@ function RootDocument({ children }: { children: React.ReactNode }) {
const pathname = useRouterState({ select: state => state.location.pathname });
const route = activeRouteData(pathname);
const title =
pathname === "/" ? "Transform" : route?.searchTerm || "Transform";
pathname === "/"
? "transform.tools — Polyglot Code Transformer Workbench"
: `${route?.searchTerm || "Transform"} — transform.tools`;
const description =
pathname === "/"
? "A polyglot web converter that's going to save you a lot of time."
+538
View File
@@ -89,3 +89,541 @@ html {
.cf-powered-by {
text-align: right !important;
}
:root {
font-family: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
color: #0a2540;
background: #f6f9fc;
}
button,
input {
font: inherit;
}
button {
cursor: pointer;
}
a {
color: inherit;
}
:focus-visible {
outline: 2px solid #635bff;
outline-offset: 2px;
}
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-thumb {
background: rgba(100, 116, 139, 0.25);
border-radius: 99px;
}
::-webkit-scrollbar-track {
background: transparent;
}
.material-symbols-outlined {
font-size: 18px;
line-height: 1;
font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}
.app-shell {
height: 100dvh;
display: flex;
flex-direction: column;
overflow: hidden;
position: relative;
background: #f6f9fc;
}
.app-shell::before {
content: "";
position: absolute;
z-index: 0;
pointer-events: none;
top: -160px;
left: 50%;
transform: translateX(-50%);
width: 1000px;
height: 340px;
background: linear-gradient(
90deg,
rgba(99, 91, 255, 0.07),
rgba(0, 218, 243, 0.05),
rgba(99, 91, 255, 0.05)
);
filter: blur(100px);
}
.app-header {
position: relative;
z-index: 2;
display: flex;
align-items: center;
justify-content: space-between;
height: 44px;
flex: none;
padding: 0 16px;
background: rgba(255, 255, 255, 0.93);
border-bottom: 1px solid #e2e8f0;
}
.header-start,
.header-actions {
display: flex;
align-items: center;
gap: 14px;
min-width: 0;
}
.header-actions {
gap: 7px;
}
.icon-button {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
padding: 0;
border: 0;
border-radius: 6px;
color: #64748b;
background: transparent;
text-decoration: none;
}
.icon-button:hover {
color: #334155;
background: #f1f5f9;
}
.icon-button svg {
width: 15px;
height: 15px;
}
.brand {
font-size: 14px;
font-weight: 600;
letter-spacing: -0.35px;
color: #1e293b;
text-decoration: none;
white-space: nowrap;
}
.brand span {
color: #635bff;
font-weight: 400;
}
.header-divider {
color: #cbd5e1;
font-family: "JetBrains Mono", monospace;
}
.route-switcher {
display: inline-flex;
align-items: center;
gap: 7px;
height: 25px;
padding: 0 8px;
border: 1px solid #e2e8f0;
border-radius: 6px;
background: #f1f5f9;
color: #64748b;
font: 11px "JetBrains Mono", monospace;
white-space: nowrap;
}
.route-switcher:hover {
background: #e9edf5;
}
.route-switcher strong {
color: #334155;
font-weight: 600;
}
.route-switcher .route-target {
color: #635bff;
}
.route-switcher .material-symbols-outlined {
font-size: 14px;
color: #94a3b8;
}
.route-switcher kbd,
.palette-search kbd,
.palette-footer kbd {
border: 1px solid #e2e8f0;
border-radius: 4px;
background: white;
padding: 2px 5px;
font: 10px "JetBrains Mono", monospace;
color: #94a3b8;
}
.app-workspace {
position: relative;
z-index: 1;
display: flex;
flex: 1;
min-height: 0;
min-width: 0;
}
.workspace-main {
display: flex;
flex: 1;
min-width: 0;
min-height: 0;
background: white;
}
.workbench-sidebar {
display: flex;
flex-direction: column;
width: 240px;
flex: none;
min-height: 0;
background: #fafbfc;
border-right: 1px solid #e2e8f0;
}
.sidebar-search {
position: relative;
padding: 10px;
border-bottom: 1px solid #e2e8f0;
}
.sidebar-search .material-symbols-outlined {
position: absolute;
top: 17px;
left: 18px;
font-size: 16px;
color: #94a3b8;
}
.sidebar-search input {
width: 100%;
height: 29px;
border: 1px solid #e2e8f0;
border-radius: 6px;
padding: 0 8px 0 28px;
font-size: 11px;
color: #334155;
background: white;
outline: none;
}
.sidebar-search input:focus {
border-color: #635bff;
}
.sidebar-search input::placeholder {
color: #94a3b8;
}
.sidebar-list {
flex: 1;
overflow-y: auto;
padding: 8px;
}
.sidebar-group {
margin-bottom: 11px;
}
.sidebar-group-title {
display: flex;
align-items: center;
justify-content: space-between;
padding: 4px 8px;
font: 600 10px "JetBrains Mono", monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #94a3b8;
}
.sidebar-group-items {
display: grid;
gap: 2px;
}
.sidebar-link {
display: flex;
align-items: center;
min-height: 28px;
padding: 4px 8px;
border: 1px solid transparent;
border-radius: 6px;
color: #475569;
font-size: 11px;
text-decoration: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.sidebar-link:hover {
color: #1e293b;
background: #f1f5f9;
}
.sidebar-link.active {
color: #635bff;
background: #eff2ff;
border-color: #d8dcee;
font-weight: 600;
}
.sidebar-link-dot {
width: 6px;
height: 6px;
flex: none;
margin-right: 7px;
border-radius: 50%;
}
.sidebar-link.active .sidebar-link-dot {
background: #635bff;
}
.sidebar-footer {
display: flex;
justify-content: space-between;
padding: 8px 12px;
border-top: 1px solid #e2e8f0;
background: #f6f9fc;
color: #94a3b8;
font: 10px "JetBrains Mono", monospace;
}
.sidebar-footer span:last-child {
color: #64748b;
}
.conversion-workspace {
width: 100%;
min-width: 0;
min-height: 0;
}
.conversion-input-column,
.conversion-output-column {
min-width: 0;
min-height: 0;
}
.conversion-input-column {
border-right: 1px solid #e2e8f0 !important;
}
.editor-panel {
min-width: 0;
min-height: 0;
background: white;
}
.editor-header {
height: 40px !important;
min-height: 40px;
padding: 0 12px !important;
border-bottom: 1px solid #e2e8f0 !important;
background: #fafbfc !important;
}
.editor-heading {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
.editor-heading-label {
font: 600 11px "JetBrains Mono", monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #94a3b8;
}
.editor-heading-slash {
color: #cbd5e1;
font: 12px "JetBrains Mono", monospace;
}
.editor-heading h2,
.editor-heading h3,
.editor-heading h4,
.editor-heading h5 {
color: #475569;
font: 500 11px "JetBrains Mono", monospace !important;
white-space: nowrap;
}
.output-panel .editor-heading h2,
.output-panel .editor-heading h3,
.output-panel .editor-heading h4,
.output-panel .editor-heading h5 {
color: #635bff;
}
.editor-header button {
height: 25px !important;
border-radius: 5px !important;
box-shadow: none !important;
font: 11px "JetBrains Mono", monospace !important;
color: #64748b;
}
.editor-header button:hover {
background: #f1f5f9 !important;
color: #334155;
}
.editor-header .editor-copy-button {
background: #0f172a !important;
color: white !important;
border: 0 !important;
border-radius: 99px !important;
padding: 0 10px !important;
}
.editor-header .editor-copy-button:hover {
background: #1e293b !important;
color: white !important;
}
.editor-footer {
display: flex;
align-items: center;
justify-content: space-between;
height: 32px;
flex: none;
padding: 0 12px;
border-top: 1px solid #e2e8f0;
color: #64748b;
background: #fafbfc;
font: 10px "JetBrains Mono", monospace;
}
.editor-footer span:last-child {
color: #10b981;
}
.editor-footer a {
color: #635bff;
text-decoration: none;
}
.editor-footer a:hover {
text-decoration: underline;
}
.output-panel .editor-footer span:last-child {
color: #94a3b8;
}
.monaco-editor {
padding-top: 0;
}
.monaco-editor,
.monaco-editor-background,
.monaco-editor .margin {
background-color: white !important;
}
.monaco-editor .margin {
background-color: #fafbfc !important;
border-right: 1px solid #f1f5f9;
}
.palette-backdrop {
position: fixed;
z-index: 50;
inset: 0;
display: flex;
align-items: flex-start;
justify-content: center;
padding: 96px 16px 16px;
background: rgba(15, 23, 42, 0.3);
}
.command-palette {
width: min(100%, 576px);
overflow: hidden;
border: 1px solid #e2e8f0;
border-radius: 12px;
background: white;
box-shadow: 0 20px 55px rgba(10, 37, 64, 0.2);
}
.palette-search {
display: flex;
align-items: center;
gap: 12px;
height: 50px;
padding: 0 16px;
background: #fafbfc;
border-bottom: 1px solid #e2e8f0;
}
.palette-search .material-symbols-outlined {
color: #635bff;
font-size: 20px;
}
.palette-search input {
flex: 1;
min-width: 0;
border: 0;
outline: 0;
background: transparent;
color: #0a2540;
font-size: 13px;
}
.palette-search input::placeholder {
color: #94a3b8;
}
.palette-results {
max-height: 320px;
overflow-y: auto;
padding: 8px;
}
.palette-heading {
padding: 7px 12px;
color: #94a3b8;
font: 10px "JetBrains Mono", monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.palette-result {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
padding: 9px 12px;
border: 1px solid transparent;
border-radius: 8px;
color: #425466;
background: white;
text-align: left;
font-size: 12px;
}
.palette-result:hover {
background: #f8fafc;
}
.palette-result.active {
color: #635bff;
background: #eff2ff;
border-color: #d8dcee;
}
.palette-result .material-symbols-outlined {
font-size: 16px;
color: #635bff;
}
.palette-result small {
margin-left: auto;
color: #94a3b8;
font: 10px "JetBrains Mono", monospace;
}
.palette-empty {
padding: 12px;
color: #64748b;
font-size: 12px;
}
.palette-footer {
display: flex;
justify-content: space-between;
padding: 10px 16px;
border-top: 1px solid #e2e8f0;
background: #fafbfc;
color: #64748b;
font: 10px "JetBrains Mono", monospace;
}
#nprogress .bar {
background: #635bff;
}
#nprogress .peg {
box-shadow: 0 0 10px #635bff, 0 0 5px #635bff;
}
@media (max-width: 800px) {
.workbench-sidebar {
width: 190px;
}
.conversion-workspace {
flex-direction: column !important;
}
.conversion-input-column {
border-right: 0 !important;
border-bottom: 1px solid #e2e8f0;
}
}
@media (max-width: 600px) {
.workbench-sidebar {
position: absolute;
top: 0;
bottom: 0;
z-index: 5;
width: min(240px, 80vw);
box-shadow: 12px 0 30px rgba(15, 23, 42, 0.12);
}
.route-switcher kbd,
.header-divider {
display: none;
}
.app-header {
padding: 0 9px;
}
.header-start {
gap: 8px;
}
.palette-backdrop {
padding-top: 60px;
}
}
+2 -1
View File
@@ -222,7 +222,7 @@ export const categorizedRoutes = [
label: "to Typescript",
path: "/js-object-to-typescript",
desc: "An online REPL for converting JS Object to Typescript."
},
}
]
},
{
@@ -426,6 +426,7 @@ export function activeRouteData(
pathname
): {
label: string;
category: string;
path: string;
searchTerm: string;
desc: string;