update:部分样式优化

This commit is contained in:
xiaozhu
2026-09-02 16:37:43 +08:00
parent 026cd085c6
commit d8e1eb9ca3
4 changed files with 81 additions and 40 deletions
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from "react";
import Editor from "@monaco-editor/react";
import { displayScriptPath } from "./scriptPath";
import { Info, Loader2Icon } from "lucide-react";
import type { ScriptItem } from "../../services/api";
@@ -114,7 +115,7 @@ export function PythonEditor({
<i className="size-1.5 rounded-full bg-[#20b77d]" />
Workspace Python Editor
</span>
<span>{script.relative_path}</span>
<span>{displayScriptPath(script.relative_path)}</span>
</div>
<div className="relative min-h-0 flex-1 overflow-hidden">
<Editor
@@ -26,6 +26,7 @@ import {type PythonEditorBuffer, useScriptWorkspaceStore} from "./state/scriptWo
import { useAuth } from "../../context/AuthContext";
import { getScriptContent } from "../../services/api";
import {PythonEditor} from "~/features/platform/PythonEditor";
import { displayScriptPath } from "./scriptPath";
function fileIconTone(type: ScriptType | "data") {
if (type === "notebook") return "text-[#e15e50] bg-[#fff0ed]";
@@ -761,7 +762,7 @@ export function ScriptWorkspace({
{script.script_name}
</h2>
<p className="m-0 font-mono text-[10px] text-[#8997a6]">
{script.relative_path}
{displayScriptPath(script.relative_path)}
</p>
</div>
<button
@@ -0,0 +1,16 @@
/**
* Storage metadata keeps workspace files under
* `workspace/<owner-user-id>/<logical-path>`. That owner segment is an
* implementation detail and should never be presented as part of a script's
* user-facing path.
*/
export function displayScriptPath(relativePath: string): string {
const normalized = relativePath.replaceAll("\\", "/");
const parts = normalized.split("/");
if (parts[0] === "workspace" && parts[1] && parts.length > 2) {
return parts.slice(2).join("/");
}
return normalized;
}