Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
Release SketchForge 0.5 edge tools
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import type { SketchForgeMcpApiPayload } from "@/lib/sketchforgeMcpProtocol";
|
||||
import {
|
||||
completeSketchForgeMcpCommand,
|
||||
dispatchSketchForgeMcpCommand,
|
||||
listSketchForgeMcpEditors,
|
||||
pollSketchForgeMcpCommand,
|
||||
registerSketchForgeMcpEditor,
|
||||
} from "@/lib/sketchforgeMcpStore";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const revalidate = false;
|
||||
|
||||
const LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
|
||||
|
||||
function isLocalRequest(request: Request) {
|
||||
const requestUrl = new URL(request.url);
|
||||
if (!LOCAL_HOSTS.has(requestUrl.hostname)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const origin = request.headers.get("origin");
|
||||
if (origin) {
|
||||
try {
|
||||
const originUrl = new URL(origin);
|
||||
if (originUrl.origin !== requestUrl.origin || !LOCAL_HOSTS.has(originUrl.hostname)) {
|
||||
return false;
|
||||
}
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const fetchSite = request.headers.get("sec-fetch-site");
|
||||
return !fetchSite || fetchSite === "same-origin" || fetchSite === "none";
|
||||
}
|
||||
|
||||
function localOnly(request: Request) {
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
return NextResponse.json({ error: "SketchForge MCP is only available in local development." }, { status: 404 });
|
||||
}
|
||||
if (!isLocalRequest(request)) {
|
||||
return NextResponse.json({ error: "SketchForge MCP only accepts localhost requests." }, { status: 403 });
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function isObject(value: unknown): value is Record<string, unknown> {
|
||||
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
||||
}
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const blocked = localOnly(request);
|
||||
if (blocked) return blocked;
|
||||
return NextResponse.json({ editors: listSketchForgeMcpEditors() });
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const blocked = localOnly(request);
|
||||
if (blocked) return blocked;
|
||||
|
||||
let body: SketchForgeMcpApiPayload;
|
||||
try {
|
||||
body = (await request.json()) as SketchForgeMcpApiPayload;
|
||||
} catch {
|
||||
return NextResponse.json({ error: "Invalid SketchForge MCP request." }, { status: 400 });
|
||||
}
|
||||
|
||||
if (!isObject(body) || typeof body.type !== "string") {
|
||||
return NextResponse.json({ error: "Invalid SketchForge MCP request." }, { status: 400 });
|
||||
}
|
||||
|
||||
if (body.type === "heartbeat") {
|
||||
if (!isObject(body.editor)) {
|
||||
return NextResponse.json({ error: "Invalid editor heartbeat." }, { status: 400 });
|
||||
}
|
||||
registerSketchForgeMcpEditor(body.editor);
|
||||
return NextResponse.json({ ok: true, editors: listSketchForgeMcpEditors() });
|
||||
}
|
||||
|
||||
if (body.type === "poll") {
|
||||
if (typeof body.editorId !== "string") {
|
||||
return NextResponse.json({ error: "Invalid editor poll." }, { status: 400 });
|
||||
}
|
||||
return NextResponse.json({ command: pollSketchForgeMcpCommand(body.editorId) });
|
||||
}
|
||||
|
||||
if (body.type === "result") {
|
||||
if (typeof body.editorId !== "string" || !isObject(body.result) || typeof body.result.commandId !== "string" || typeof body.result.ok !== "boolean") {
|
||||
return NextResponse.json({ error: "Invalid command result." }, { status: 400 });
|
||||
}
|
||||
return NextResponse.json({ ok: completeSketchForgeMcpCommand(body.editorId, body.result) });
|
||||
}
|
||||
|
||||
if (body.type === "command") {
|
||||
if (typeof body.action !== "string") {
|
||||
return NextResponse.json({ error: "Invalid command action." }, { status: 400 });
|
||||
}
|
||||
const result = await dispatchSketchForgeMcpCommand({
|
||||
editorId: typeof body.editorId === "string" ? body.editorId : undefined,
|
||||
editorNumber: typeof body.editorNumber === "number" ? body.editorNumber : undefined,
|
||||
action: body.action,
|
||||
params: isObject(body.params) ? body.params : {},
|
||||
timeoutMs: typeof body.timeoutMs === "number" ? body.timeoutMs : undefined,
|
||||
});
|
||||
return NextResponse.json(result, { status: result.ok ? 200 : 504 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ error: "Unknown SketchForge MCP request." }, { status: 400 });
|
||||
}
|
||||
+324
-62
@@ -182,10 +182,11 @@ button {
|
||||
.dashboard-nav-item {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
height: 42px;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 0 12px;
|
||||
gap: 8px;
|
||||
padding: 0 8px;
|
||||
color: #40586f;
|
||||
background: transparent;
|
||||
border-radius: 6px;
|
||||
@@ -208,6 +209,14 @@ button {
|
||||
background: #e8f6fc;
|
||||
}
|
||||
|
||||
.dashboard-nav-item:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.dashboard-nav-item:focus-visible {
|
||||
box-shadow: inset 0 0 0 2px #52bfe9;
|
||||
}
|
||||
|
||||
.dashboard-settings-button {
|
||||
color: #536a80;
|
||||
}
|
||||
@@ -231,6 +240,20 @@ button {
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.dashboard-coming-soon {
|
||||
display: grid;
|
||||
min-height: calc(100vh - 64px - 44px);
|
||||
place-items: center;
|
||||
color: #173a56;
|
||||
}
|
||||
|
||||
.dashboard-coming-soon strong {
|
||||
font-size: clamp(42px, 7vw, 96px);
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dashboard-action-tile {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
@@ -989,7 +1012,6 @@ button {
|
||||
}
|
||||
|
||||
.edge-modifier-header,
|
||||
.edge-modifier-value-row,
|
||||
.edge-modifier-quick-actions,
|
||||
.edge-modifier-footer,
|
||||
.edge-modifier-check {
|
||||
@@ -1110,6 +1132,18 @@ button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.edge-modifier-history-toggle,
|
||||
.edge-modifier-history-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.edge-modifier-history-toggle {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.edge-modifier-history-actions button:disabled {
|
||||
color: #9aa8b3;
|
||||
background: #f4f6f8;
|
||||
@@ -1123,6 +1157,43 @@ button {
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.edge-modifier-history-list {
|
||||
display: grid;
|
||||
gap: 5px;
|
||||
max-height: 170px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.edge-modifier-history-item {
|
||||
justify-content: flex-start;
|
||||
min-height: 42px;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
|
||||
.edge-modifier-history-item > span {
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.edge-modifier-history-item strong,
|
||||
.edge-modifier-history-item small {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.edge-modifier-history-item strong {
|
||||
color: #6d4310;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.edge-modifier-history-item small {
|
||||
color: #7a6851;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.edge-modifier-field {
|
||||
display: block;
|
||||
margin-top: 11px;
|
||||
@@ -1131,18 +1202,6 @@ button {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.edge-modifier-value-row {
|
||||
gap: 7px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.edge-modifier-value-row input[type="range"] {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
accent-color: #139ed0;
|
||||
}
|
||||
|
||||
.edge-modifier-value-row input[type="number"],
|
||||
.edge-modifier-field select {
|
||||
height: 31px;
|
||||
color: #263f53;
|
||||
@@ -1151,11 +1210,6 @@ button {
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.edge-modifier-value-row input[type="number"] {
|
||||
width: 72px;
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
.edge-modifier-field select {
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
@@ -1273,6 +1327,57 @@ button {
|
||||
stroke-width: 1.8;
|
||||
}
|
||||
|
||||
.sketch-tool-icon .sketch-reference-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.sketch-reference-icon {
|
||||
--sketch-icon-offset-y: 0;
|
||||
--sketch-icon-scale: 1;
|
||||
display: block;
|
||||
object-fit: contain;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
opacity: 0.96;
|
||||
transform:
|
||||
translateY(var(--sketch-icon-offset-y))
|
||||
scale(var(--sketch-icon-scale));
|
||||
transition: filter 120ms ease, opacity 120ms ease;
|
||||
}
|
||||
|
||||
.sketch-reference-icon[data-sketch-icon="line"],
|
||||
.sketch-reference-icon[data-sketch-icon="erase"],
|
||||
.sketch-reference-icon[data-sketch-icon="measure"],
|
||||
.sketch-reference-icon[data-sketch-icon="select"] {
|
||||
--sketch-icon-scale: 0.94;
|
||||
}
|
||||
|
||||
.sketch-reference-icon[data-sketch-icon="bezier"] {
|
||||
--sketch-icon-scale: 1.12;
|
||||
}
|
||||
|
||||
.sketch-reference-icon[data-sketch-icon="smooth"] {
|
||||
--sketch-icon-scale: 1.16;
|
||||
}
|
||||
|
||||
.sketch-reference-icon[data-sketch-icon="image"] {
|
||||
--sketch-icon-scale: 1.06;
|
||||
}
|
||||
|
||||
.sketch-reference-icon[data-sketch-icon="refine"] {
|
||||
--sketch-icon-scale: 1.12;
|
||||
}
|
||||
|
||||
.sketch-reference-icon[data-sketch-icon="sketchTo3d"],
|
||||
.sketch-reference-icon[data-sketch-icon="editSketchTo3d"] {
|
||||
--sketch-icon-scale: 1.08;
|
||||
}
|
||||
|
||||
.sketch-reference-icon[data-sketch-icon="sketchTo3d"] {
|
||||
--sketch-icon-scale: 1.08;
|
||||
}
|
||||
|
||||
.sketch-command-button {
|
||||
display: inline-flex;
|
||||
height: 43px;
|
||||
@@ -1297,6 +1402,11 @@ button {
|
||||
stroke-width: 1.8;
|
||||
}
|
||||
|
||||
.sketch-command-button .sketch-reference-icon {
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
}
|
||||
|
||||
.sketch-command-button:hover:not(:disabled) {
|
||||
color: #17405d;
|
||||
background: #e7f5fb;
|
||||
@@ -1317,6 +1427,25 @@ button {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.toolbar-icon.disabled .sketch-reference-icon,
|
||||
.toolbar-icon:disabled .sketch-reference-icon,
|
||||
.sketch-command-button.disabled .sketch-reference-icon,
|
||||
.sketch-command-button:disabled .sketch-reference-icon {
|
||||
filter: grayscale(1) brightness(1.25);
|
||||
opacity: 0.34;
|
||||
}
|
||||
|
||||
.toolbar-icon:not(.disabled):hover .sketch-reference-icon,
|
||||
.sketch-command-button:hover:not(:disabled) .sketch-reference-icon {
|
||||
filter: contrast(1.08) brightness(0.95);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.toolbar-icon.active .sketch-reference-icon {
|
||||
filter: contrast(1.12) brightness(0.9) drop-shadow(0 0 5px rgba(0, 156, 222, 0.28));
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.toolbar-workspace-tabs {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@@ -1509,6 +1638,12 @@ button {
|
||||
height: 43px;
|
||||
}
|
||||
|
||||
.toolbar-icon .toolbar-art-toolbar-chamfer,
|
||||
.toolbar-icon .toolbar-art-toolbar-fillet {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.toolbar-icon.disabled .toolbar-command-icon {
|
||||
filter: grayscale(1) brightness(1.25);
|
||||
opacity: 0.22;
|
||||
@@ -2052,6 +2187,18 @@ button {
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
|
||||
.sketch-reference-shapes .sketch-reference-mesh-face {
|
||||
fill: rgba(207, 142, 42, 0.22);
|
||||
stroke: none;
|
||||
}
|
||||
|
||||
.sketch-reference-shapes .sketch-reference-mesh-outline {
|
||||
fill: none;
|
||||
stroke: rgba(188, 113, 18, 0.7);
|
||||
stroke-width: 1.25;
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
|
||||
.sketch-reference-images image {
|
||||
cursor: move;
|
||||
image-rendering: auto;
|
||||
@@ -2217,6 +2364,26 @@ button {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sketch-measurement.pending > line {
|
||||
stroke: #169fce;
|
||||
}
|
||||
|
||||
.sketch-measurement-point {
|
||||
fill: #ffffff;
|
||||
stroke: #d56100;
|
||||
stroke-width: 2;
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
|
||||
.sketch-measurement-point.pending {
|
||||
stroke: #169fce;
|
||||
}
|
||||
|
||||
.sketch-measurement-point.hover {
|
||||
fill: #169fce;
|
||||
stroke: #ffffff;
|
||||
}
|
||||
|
||||
.sketch-measurement-pill {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -2590,6 +2757,11 @@ button {
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
.workplane-wrap.modifier-edge-pick .three-workplane-host,
|
||||
.workplane-wrap.modifier-edge-pick .three-workplane-host:active {
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
.three-workplane-host canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
@@ -3312,8 +3484,12 @@ button {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.shape-inspector .edit-sketch-button {
|
||||
display: block;
|
||||
.shape-inspector .edit-sketch-button,
|
||||
.shape-inspector .inspector-action-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
width: calc(100% - 20px);
|
||||
height: 38px;
|
||||
margin: 0 10px 12px;
|
||||
@@ -3326,13 +3502,15 @@ button {
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.shape-inspector .edit-sketch-button:hover:not(:disabled) {
|
||||
.shape-inspector .edit-sketch-button:hover:not(:disabled),
|
||||
.shape-inspector .inspector-action-button:hover:not(:disabled) {
|
||||
color: #0d7198;
|
||||
background: #eaf7fb;
|
||||
border-color: #8ecbdf;
|
||||
}
|
||||
|
||||
.shape-inspector .edit-sketch-button:disabled {
|
||||
.shape-inspector .edit-sketch-button:disabled,
|
||||
.shape-inspector .inspector-action-button:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
@@ -3378,12 +3556,109 @@ button {
|
||||
|
||||
.range-property {
|
||||
display: grid;
|
||||
gap: 9px;
|
||||
gap: 7px;
|
||||
color: #637286;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.range-property-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.range-property-name {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: #586a7d;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.range-value-control {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
min-width: 88px;
|
||||
min-height: 31px;
|
||||
padding: 0 7px;
|
||||
color: #51657a;
|
||||
background: #fff;
|
||||
border: 1px solid #c7d4df;
|
||||
border-radius: 6px;
|
||||
box-shadow: inset 0 1px 1px rgba(25, 45, 65, 0.04);
|
||||
}
|
||||
|
||||
.range-value-control:focus-within {
|
||||
border-color: #55add8;
|
||||
box-shadow: 0 0 0 3px rgba(0, 156, 222, 0.14);
|
||||
}
|
||||
|
||||
.range-value-control input {
|
||||
width: 58px;
|
||||
min-width: 0;
|
||||
height: 29px;
|
||||
padding: 0;
|
||||
appearance: textfield;
|
||||
color: #2f4457;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
font: 750 14px/1 var(--font-ui);
|
||||
letter-spacing: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.range-value-control input:disabled {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.range-value-control input::-webkit-outer-spin-button,
|
||||
.range-value-control input::-webkit-inner-spin-button {
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.range-value-unit {
|
||||
color: #7b8da0;
|
||||
font-size: 11px;
|
||||
font-weight: 850;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.edge-modifier-slider.range-property {
|
||||
margin-top: 12px;
|
||||
color: #415a6e;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.edge-modifier-slider .range-property-header {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.edge-modifier-slider .range-property-name {
|
||||
color: #415a6e;
|
||||
}
|
||||
|
||||
.edge-modifier-slider .range-value-control {
|
||||
min-width: 84px;
|
||||
border-color: #bdcdda;
|
||||
}
|
||||
|
||||
.edge-modifier-slider .range-value-control input {
|
||||
width: 50px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.edge-modifier-slider .range-value-unit {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.text-property {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
@@ -3435,42 +3710,15 @@ button {
|
||||
|
||||
.range-control {
|
||||
position: relative;
|
||||
height: 22px;
|
||||
padding: 0 21px;
|
||||
}
|
||||
|
||||
.range-control output,
|
||||
.range-value-input {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: -3px;
|
||||
left: clamp(22px, calc(var(--slider-pos) + 7px), calc(100% - 22px));
|
||||
min-width: 31px;
|
||||
height: 31px;
|
||||
padding: 0 8px;
|
||||
color: #617287;
|
||||
font-size: 15px;
|
||||
line-height: 29px;
|
||||
text-align: center;
|
||||
background: white;
|
||||
border: 1px solid #cbd6e1;
|
||||
border-radius: 999px;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.range-control output {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.range-value-input {
|
||||
width: 70px;
|
||||
outline: 0;
|
||||
font: 700 15px/29px var(--font-ui);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 24px;
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
.range-control input[type="range"] {
|
||||
width: 100%;
|
||||
height: 22px;
|
||||
height: 24px;
|
||||
margin: 0;
|
||||
appearance: none;
|
||||
background: transparent;
|
||||
@@ -3478,30 +3726,44 @@ button {
|
||||
}
|
||||
|
||||
.range-control input[type="range"]::-webkit-slider-runnable-track {
|
||||
height: 4px;
|
||||
height: 5px;
|
||||
background:
|
||||
linear-gradient(to right, #00a6db 0 var(--slider-pos), #dbe1e7 var(--slider-pos) 100%);
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.range-control input[type="range"]::-webkit-slider-thumb {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
margin-top: -6px;
|
||||
appearance: none;
|
||||
background: #ffffff;
|
||||
border: 2px solid #00a6db;
|
||||
border-radius: 999px;
|
||||
box-shadow: 0 1px 4px rgba(24, 48, 68, 0.2);
|
||||
}
|
||||
|
||||
.range-control input[type="range"]::-moz-range-track {
|
||||
height: 4px;
|
||||
height: 5px;
|
||||
background: #dbe1e7;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.range-control input[type="range"]::-moz-range-progress {
|
||||
height: 4px;
|
||||
height: 5px;
|
||||
background: #00a6db;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.range-control input[type="range"]::-moz-range-thumb {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background: #ffffff;
|
||||
border: 2px solid #00a6db;
|
||||
border-radius: 999px;
|
||||
box-shadow: 0 1px 4px rgba(24, 48, 68, 0.2);
|
||||
}
|
||||
|
||||
.inspector-header-icon:hover,
|
||||
.shape-state-card button:not(:disabled):hover {
|
||||
background: #eef8fc;
|
||||
|
||||
+126
-99
@@ -10,6 +10,7 @@ import type { GridSize, WorkplaneShape, WorkplaneWorkspaceSettings } from "@/typ
|
||||
|
||||
type AppView = "dashboard" | "editor";
|
||||
type ViewMode = "grid" | "list";
|
||||
type DashboardSection = "home" | "challenges";
|
||||
type DownloadMode = "browser" | "folder";
|
||||
|
||||
type DashboardProject = {
|
||||
@@ -244,6 +245,7 @@ export default function Home() {
|
||||
const [editorStarted, setEditorStarted] = useState(false);
|
||||
const [activeProjectId, setActiveProjectId] = useState<string | null>(null);
|
||||
const [projects, setProjects] = useState<DashboardProject[]>([]);
|
||||
const [dashboardSection, setDashboardSection] = useState<DashboardSection>("home");
|
||||
const [query, setQuery] = useState("");
|
||||
const [viewMode, setViewMode] = useState<ViewMode>("grid");
|
||||
const [sortMode, setSortMode] = useState("recent");
|
||||
@@ -550,6 +552,7 @@ export default function Home() {
|
||||
if (activeProjectId) {
|
||||
setProjects((current) => current.map((project) => (project.id === activeProjectId ? { ...project, updatedAt: Date.now() } : project)));
|
||||
}
|
||||
setDashboardSection("home");
|
||||
setView("dashboard");
|
||||
if (typeof window !== "undefined") {
|
||||
window.history.replaceState(null, "", "/");
|
||||
@@ -619,6 +622,7 @@ export default function Home() {
|
||||
/>
|
||||
{view === "dashboard" ? (
|
||||
<Dashboard
|
||||
dashboardSection={dashboardSection}
|
||||
dashboardNotice={dashboardNotice}
|
||||
downloadFolder={downloadFolder}
|
||||
downloadMode={downloadMode}
|
||||
@@ -634,6 +638,11 @@ export default function Home() {
|
||||
onDownloadFolderChange={setDownloadFolder}
|
||||
onDownloadModeChange={setDownloadMode}
|
||||
onImportStl={() => dashboardStlInputRef.current?.click()}
|
||||
onChallenges={() => {
|
||||
setDashboardSection("challenges");
|
||||
setDashboardNotice("");
|
||||
}}
|
||||
onDashboardHome={() => setDashboardSection("home")}
|
||||
onOpenProject={openEditor}
|
||||
onOpenSettings={() => setSettingsOpen(true)}
|
||||
onQueryChange={setQuery}
|
||||
@@ -664,6 +673,7 @@ export default function Home() {
|
||||
}
|
||||
|
||||
function Dashboard({
|
||||
dashboardSection,
|
||||
dashboardNotice,
|
||||
downloadFolder,
|
||||
downloadMode,
|
||||
@@ -679,6 +689,8 @@ function Dashboard({
|
||||
onDownloadFolderChange,
|
||||
onDownloadModeChange,
|
||||
onImportStl,
|
||||
onChallenges,
|
||||
onDashboardHome,
|
||||
onOpenProject,
|
||||
onOpenSettings,
|
||||
onQueryChange,
|
||||
@@ -687,6 +699,7 @@ function Dashboard({
|
||||
onViewModeChange,
|
||||
onWorkspace,
|
||||
}: {
|
||||
dashboardSection: DashboardSection;
|
||||
dashboardNotice: string;
|
||||
downloadFolder: string;
|
||||
downloadMode: DownloadMode;
|
||||
@@ -702,6 +715,8 @@ function Dashboard({
|
||||
onDownloadFolderChange: (value: string) => void;
|
||||
onDownloadModeChange: (value: DownloadMode) => void;
|
||||
onImportStl: () => void;
|
||||
onChallenges: () => void;
|
||||
onDashboardHome: () => void;
|
||||
onOpenProject: (projectId: string) => void;
|
||||
onOpenSettings: () => void;
|
||||
onQueryChange: (value: string) => void;
|
||||
@@ -766,10 +781,14 @@ function Dashboard({
|
||||
<div className="dashboard-layout">
|
||||
<aside className="dashboard-sidebar">
|
||||
<div className="dashboard-nav-stack">
|
||||
<button className="dashboard-nav-item active" type="button" aria-label="Home" title="Home">
|
||||
<button className={`dashboard-nav-item ${dashboardSection === "home" ? "active" : ""}`} type="button" aria-label="Home" title="Home" onClick={onDashboardHome}>
|
||||
<HomeIcon size={20} />
|
||||
<span>Home</span>
|
||||
</button>
|
||||
<button className={`dashboard-nav-item ${dashboardSection === "challenges" ? "active" : ""}`} type="button" aria-label="Challenges" title="Challenges" onClick={onChallenges}>
|
||||
<SlidersHorizontal size={20} />
|
||||
<span>Challenges</span>
|
||||
</button>
|
||||
</div>
|
||||
<button className="dashboard-nav-item dashboard-settings-button" type="button" aria-label="Download settings" title="Download settings" onClick={onOpenSettings}>
|
||||
<Settings size={20} />
|
||||
@@ -777,106 +796,114 @@ function Dashboard({
|
||||
</button>
|
||||
</aside>
|
||||
|
||||
<section className="dashboard-main" aria-label="Dashboard">
|
||||
<div className="dashboard-actions-band">
|
||||
<button className="dashboard-action-tile create" type="button" onClick={onCreate}>
|
||||
<span className="dashboard-action-icon">
|
||||
<Plus size={25} strokeWidth={2.8} />
|
||||
</span>
|
||||
<span>Create new 3D design</span>
|
||||
</button>
|
||||
<button className="dashboard-action-tile" type="button" onClick={onImportStl}>
|
||||
<span className="dashboard-action-icon">
|
||||
<FileUp size={24} strokeWidth={2.4} />
|
||||
</span>
|
||||
<span>Import STL</span>
|
||||
</button>
|
||||
<button className="dashboard-action-tile" type="button" onClick={onWorkspace}>
|
||||
<span className="dashboard-action-icon">
|
||||
<Clock3 size={24} strokeWidth={2.4} />
|
||||
</span>
|
||||
<span>Continue workplane</span>
|
||||
</button>
|
||||
</div>
|
||||
{dashboardNotice ? (
|
||||
<div className="dashboard-import-notice" role="status">
|
||||
{dashboardNotice}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="dashboard-section-header">
|
||||
<div>
|
||||
<h1>Projects</h1>
|
||||
<span>{projects.length} visible</span>
|
||||
</div>
|
||||
<div className="dashboard-controls">
|
||||
<label className="dashboard-select">
|
||||
<SlidersHorizontal size={17} />
|
||||
<select value={sortMode} onChange={(event) => onSortModeChange(event.currentTarget.value)} aria-label="Sort projects">
|
||||
<option value="recent">Recent</option>
|
||||
<option value="name">Name</option>
|
||||
</select>
|
||||
</label>
|
||||
<div className="dashboard-segmented" aria-label="Project view">
|
||||
<button className={viewMode === "grid" ? "active" : ""} type="button" aria-label="Grid view" onClick={() => onViewModeChange("grid")}>
|
||||
<Grid3X3 size={17} />
|
||||
</button>
|
||||
<button className={viewMode === "list" ? "active" : ""} type="button" aria-label="List view" onClick={() => onViewModeChange("list")}>
|
||||
<List size={18} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{projects.length > 0 ? (
|
||||
<div className={viewMode === "grid" ? "project-grid" : "project-list"}>
|
||||
{projects.map((project) => (
|
||||
<article className="project-card" key={project.id}>
|
||||
<button className="project-card-open" type="button" onClick={() => onOpenProject(project.id)}>
|
||||
<ProjectPreview accent={project.accent} thumbnailUrl={project.thumbnailUrl} />
|
||||
<span className="project-card-title">{project.name}</span>
|
||||
<span className="project-card-meta">
|
||||
{formatUpdated(project.updatedAt)} - {project.shapes} shapes
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
className="project-menu-trigger"
|
||||
type="button"
|
||||
aria-label={`Project options for ${project.name}`}
|
||||
aria-expanded={openProjectMenuId === project.id}
|
||||
title="Project options"
|
||||
onClick={() => setOpenProjectMenuId((current) => (current === project.id ? null : project.id))}
|
||||
>
|
||||
<EllipsisVertical size={19} strokeWidth={2.5} />
|
||||
</button>
|
||||
{openProjectMenuId === project.id ? (
|
||||
<div className="project-card-menu" role="menu" aria-label={`Options for ${project.name}`}>
|
||||
<button type="button" role="menuitem" onClick={() => startProjectRename(project)}>
|
||||
<Pencil size={16} />
|
||||
<span>Rename</span>
|
||||
</button>
|
||||
<button
|
||||
className="delete"
|
||||
type="button"
|
||||
role="menuitem"
|
||||
onClick={() => {
|
||||
setOpenProjectMenuId(null);
|
||||
setProjectPendingDeleteId(project.id);
|
||||
}}
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
</article>
|
||||
))}
|
||||
<section className="dashboard-main" aria-label={dashboardSection === "challenges" ? "Challenges" : "Dashboard"}>
|
||||
{dashboardSection === "challenges" ? (
|
||||
<div className="dashboard-coming-soon" role="status">
|
||||
<strong>Coming soon</strong>
|
||||
</div>
|
||||
) : (
|
||||
<div className="project-empty">
|
||||
<strong>No projects yet</strong>
|
||||
<span>Create a 3D design and it will appear here.</span>
|
||||
</div>
|
||||
<>
|
||||
<div className="dashboard-actions-band">
|
||||
<button className="dashboard-action-tile create" type="button" onClick={onCreate}>
|
||||
<span className="dashboard-action-icon">
|
||||
<Plus size={25} strokeWidth={2.8} />
|
||||
</span>
|
||||
<span>Create new 3D design</span>
|
||||
</button>
|
||||
<button className="dashboard-action-tile" type="button" onClick={onImportStl}>
|
||||
<span className="dashboard-action-icon">
|
||||
<FileUp size={24} strokeWidth={2.4} />
|
||||
</span>
|
||||
<span>Import STL</span>
|
||||
</button>
|
||||
<button className="dashboard-action-tile" type="button" onClick={onWorkspace}>
|
||||
<span className="dashboard-action-icon">
|
||||
<Clock3 size={24} strokeWidth={2.4} />
|
||||
</span>
|
||||
<span>Continue workplane</span>
|
||||
</button>
|
||||
</div>
|
||||
{dashboardNotice ? (
|
||||
<div className="dashboard-import-notice" role="status">
|
||||
{dashboardNotice}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="dashboard-section-header">
|
||||
<div>
|
||||
<h1>Projects</h1>
|
||||
<span>{projects.length} visible</span>
|
||||
</div>
|
||||
<div className="dashboard-controls">
|
||||
<label className="dashboard-select">
|
||||
<SlidersHorizontal size={17} />
|
||||
<select value={sortMode} onChange={(event) => onSortModeChange(event.currentTarget.value)} aria-label="Sort projects">
|
||||
<option value="recent">Recent</option>
|
||||
<option value="name">Name</option>
|
||||
</select>
|
||||
</label>
|
||||
<div className="dashboard-segmented" aria-label="Project view">
|
||||
<button className={viewMode === "grid" ? "active" : ""} type="button" aria-label="Grid view" onClick={() => onViewModeChange("grid")}>
|
||||
<Grid3X3 size={17} />
|
||||
</button>
|
||||
<button className={viewMode === "list" ? "active" : ""} type="button" aria-label="List view" onClick={() => onViewModeChange("list")}>
|
||||
<List size={18} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{projects.length > 0 ? (
|
||||
<div className={viewMode === "grid" ? "project-grid" : "project-list"}>
|
||||
{projects.map((project) => (
|
||||
<article className="project-card" key={project.id}>
|
||||
<button className="project-card-open" type="button" onClick={() => onOpenProject(project.id)}>
|
||||
<ProjectPreview accent={project.accent} thumbnailUrl={project.thumbnailUrl} />
|
||||
<span className="project-card-title">{project.name}</span>
|
||||
<span className="project-card-meta">
|
||||
{formatUpdated(project.updatedAt)} - {project.shapes} shapes
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
className="project-menu-trigger"
|
||||
type="button"
|
||||
aria-label={`Project options for ${project.name}`}
|
||||
aria-expanded={openProjectMenuId === project.id}
|
||||
title="Project options"
|
||||
onClick={() => setOpenProjectMenuId((current) => (current === project.id ? null : project.id))}
|
||||
>
|
||||
<EllipsisVertical size={19} strokeWidth={2.5} />
|
||||
</button>
|
||||
{openProjectMenuId === project.id ? (
|
||||
<div className="project-card-menu" role="menu" aria-label={`Options for ${project.name}`}>
|
||||
<button type="button" role="menuitem" onClick={() => startProjectRename(project)}>
|
||||
<Pencil size={16} />
|
||||
<span>Rename</span>
|
||||
</button>
|
||||
<button
|
||||
className="delete"
|
||||
type="button"
|
||||
role="menuitem"
|
||||
onClick={() => {
|
||||
setOpenProjectMenuId(null);
|
||||
setProjectPendingDeleteId(project.id);
|
||||
}}
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="project-empty">
|
||||
<strong>No projects yet</strong>
|
||||
<span>Create a 3D design and it will appear here.</span>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user