updata:icon替换
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
import Icon from "../../components/common/Icon";
|
||||
import {
|
||||
BookOpen,
|
||||
Check,
|
||||
ChevronRight,
|
||||
ExternalLink,
|
||||
FileCode,
|
||||
Info,
|
||||
Lock,
|
||||
Plus,
|
||||
RefreshCw,
|
||||
X,
|
||||
} from "lucide-react";
|
||||
import type {
|
||||
ActiveEditSession,
|
||||
LatestVersion,
|
||||
@@ -401,6 +412,8 @@ export function ScriptWorkspace({
|
||||
}
|
||||
}, [script.script_id, script.workspace_id, isReadOnlyMode, readOnlyRefreshVersion]);
|
||||
|
||||
const ScriptTypeIcon = scriptIcon(script);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="relative flex h-[43px] min-h-[43px] items-stretch overflow-hidden border-b border-[#e5ebf1] bg-[#f7f9fb]">
|
||||
@@ -410,7 +423,7 @@ export function ScriptWorkspace({
|
||||
aria-label="向左滚动"
|
||||
onClick={() => scroll("left")}
|
||||
>
|
||||
<Icon name="chevron" size={16} />
|
||||
<ChevronRight size={16} />
|
||||
</button>
|
||||
<div
|
||||
className="tabbar-scroll flex flex-1 overflow-x-auto overflow-y-hidden scroll-smooth"
|
||||
@@ -432,10 +445,9 @@ export function ScriptWorkspace({
|
||||
<span
|
||||
className={`grid size-[25px] shrink-0 place-items-center rounded-[5px] ${fileIconTone(tab.scriptType)}`}
|
||||
>
|
||||
<Icon
|
||||
name={tab.scriptType === "notebook" ? "notebook" : "python"}
|
||||
size={16}
|
||||
/>
|
||||
{tab.scriptType === "notebook"
|
||||
? <BookOpen size={16} />
|
||||
: <FileCode size={16} />}
|
||||
</span>
|
||||
<span className="min-w-0 flex-1 truncate">{tab.scriptName}</span>
|
||||
<button
|
||||
@@ -444,7 +456,7 @@ export function ScriptWorkspace({
|
||||
aria-label="关闭标签"
|
||||
onClick={(event) => onClose(tab.scriptId, event)}
|
||||
>
|
||||
<Icon name="close" size={14} />
|
||||
<X size={14} />
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
@@ -454,7 +466,7 @@ export function ScriptWorkspace({
|
||||
type="button"
|
||||
onClick={onNewTab}
|
||||
>
|
||||
<Icon name="plus" size={17} />
|
||||
<Plus size={17} />
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
@@ -463,7 +475,7 @@ export function ScriptWorkspace({
|
||||
aria-label="向右滚动"
|
||||
onClick={() => scroll("right")}
|
||||
>
|
||||
<Icon name="chevron" size={16} />
|
||||
<ChevronRight size={16} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -472,10 +484,10 @@ export function ScriptWorkspace({
|
||||
<span
|
||||
className={`grid size-[25px] shrink-0 place-items-center rounded-[5px] ${fileIconTone(script.script_type)}`}
|
||||
>
|
||||
<Icon name={scriptIcon(script)} size={17} />
|
||||
<ScriptTypeIcon size={17} />
|
||||
</span>
|
||||
<span>工作副本</span>
|
||||
<Icon name="chevron" size={13} />
|
||||
<ChevronRight size={13} />
|
||||
<strong className="max-w-[300px] truncate text-[#45576b]">
|
||||
{script.script_name}
|
||||
</strong>
|
||||
@@ -561,7 +573,7 @@ export function ScriptWorkspace({
|
||||
这个锁只在本浏览器当前 tab 内有效,不能阻止隐身模式 / 其它浏览器同时编辑。 */}
|
||||
{isEditing && (
|
||||
<div className="flex shrink-0 items-center justify-center gap-2 border-b border-[#c9def9] bg-[#e7f1ff] px-4 py-1.5 text-xs font-medium text-[#1f4e8a]">
|
||||
<Icon name="info" size={14} />
|
||||
<Info size={14} />
|
||||
<span>
|
||||
本地编辑锁——关闭标签页、刷新页面或换浏览器后失效,不会阻止他人同时编辑。
|
||||
</span>
|
||||
@@ -574,7 +586,7 @@ export function ScriptWorkspace({
|
||||
<div style={{ display: isReadOnlyMode ? 'block' : 'none', height: '100%' }}>
|
||||
<div className="flex h-full flex-col overflow-hidden bg-[#f8f9fa]">
|
||||
<div className="mb-1.5 flex shrink-0 items-center justify-center gap-2 border-b border-[#e0e0e0] bg-[#fff3cd] px-4 py-2 text-[13px] font-medium text-[#856404]">
|
||||
<Icon name="lock" size={16} />
|
||||
<Lock size={16} />
|
||||
<span>此文件已被锁定,您当前处于只读模式</span>
|
||||
</div>
|
||||
<div className="min-h-0 flex-1 overflow-y-auto">
|
||||
@@ -585,7 +597,7 @@ export function ScriptWorkspace({
|
||||
</div>
|
||||
) : readOnlyError ? (
|
||||
<div className="flex min-h-[200px] flex-col items-center justify-center gap-3 p-5 text-center text-sm text-[#dc3545]">
|
||||
<Icon name="info" size={28} />
|
||||
<Info size={28} />
|
||||
<strong className="text-base">加载失败</strong>
|
||||
<p className="m-0 text-[#666]">{readOnlyError}</p>
|
||||
</div>
|
||||
@@ -712,7 +724,7 @@ export function ScriptWorkspace({
|
||||
}`}
|
||||
>
|
||||
{openError
|
||||
? <Icon name="info" size={28} />
|
||||
? <Info size={28} />
|
||||
: <span className="button-spinner button-spinner--blue size-6 border-[3px]" />}
|
||||
</div>
|
||||
<strong className="text-base text-[#1d344d]">
|
||||
@@ -732,7 +744,7 @@ export function ScriptWorkspace({
|
||||
>
|
||||
{editBusy
|
||||
? <span className="button-spinner button-spinner--blue" />
|
||||
: <Icon name="refresh" size={16} />}
|
||||
: <RefreshCw size={16} />}
|
||||
{editBusy ? "正在重试…" : "重试打开"}
|
||||
</button>
|
||||
)}
|
||||
@@ -763,7 +775,7 @@ export function ScriptWorkspace({
|
||||
>
|
||||
{editBusy
|
||||
? <span className="button-spinner button-spinner--blue" />
|
||||
: <Icon name="external" size={17} />}
|
||||
: <ExternalLink size={17} />}
|
||||
{editBusy
|
||||
? "正在准备编辑器…"
|
||||
: isEditing
|
||||
@@ -817,7 +829,7 @@ export function ScriptWorkspace({
|
||||
|
||||
<div className="mt-3 flex flex-wrap items-center gap-x-5 gap-y-2 px-1 text-[11px] text-[#7a8b9c]">
|
||||
<span className="inline-flex items-center gap-[5px] text-[#25875e]">
|
||||
<Icon name="check" size={15} />
|
||||
<Check size={15} />
|
||||
</span>
|
||||
<span>SHA-256 {shortHash(script.content_hash)}</span>
|
||||
<span>
|
||||
|
||||
Reference in New Issue
Block a user