From 39e2102a18271bd914804d67058685c0e82c8ba4 Mon Sep 17 00:00:00 2001 From: dmitriylaukhin Date: Fri, 26 Jun 2026 12:15:42 +0500 Subject: [PATCH] Gate Obsidian Toolbox behind TOOLBOX_VISIBLE flag Toolbox is still being refined; hide it from clients on prod while keeping it usable on staging. Entry points (header link, dashboard card) render only when TOOLBOX_VISIBLE=true; a tools/layout redirects /tools/* to /dashboard otherwise. Routes and ToolUsage table are untouched (no destructive migration). Co-Authored-By: Claude Opus 4.8 (1M context) --- .env.example | 4 ++++ src/app/(student)/dashboard/page.tsx | 8 +++++--- src/app/(student)/layout.tsx | 8 +++++--- src/app/(student)/tools/layout.tsx | 8 ++++++++ 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 src/app/(student)/tools/layout.tsx diff --git a/.env.example b/.env.example index c940c30..71c35ab 100644 --- a/.env.example +++ b/.env.example @@ -41,3 +41,7 @@ LISTMONK_QUIZ_LIST_ID="" # Freemium gate: ID wow-урока (2.6 «ежедневные заметки») — после его завершения # показываем лестницу-оффер (трипвайр + полный курс) WOW_MOMENT_LESSON_ID="obs-start-l2-006" + +# Obsidian Toolbox (/tools): "true" — показывать точки входа и роуты (staging); +# не задано/иное — скрыто, /tools редиректит на /dashboard (prod, пока дорабатываем) +TOOLBOX_VISIBLE="" diff --git a/src/app/(student)/dashboard/page.tsx b/src/app/(student)/dashboard/page.tsx index 527ecf6..e010757 100644 --- a/src/app/(student)/dashboard/page.tsx +++ b/src/app/(student)/dashboard/page.tsx @@ -168,9 +168,11 @@ export default async function StudentDashboard() { )} -
- -
+ {process.env.TOOLBOX_VISIBLE === "true" && ( +
+ +
+ )} {locked.length > 0 && (
diff --git a/src/app/(student)/layout.tsx b/src/app/(student)/layout.tsx index 1ae9dfc..2c4f27c 100644 --- a/src/app/(student)/layout.tsx +++ b/src/app/(student)/layout.tsx @@ -57,9 +57,11 @@ export default async function StudentLayout({ children }: { children: React.Reac Wrapped - - Инструменты - + {process.env.TOOLBOX_VISIBLE === "true" && ( + + Инструменты + + )} Вопросы diff --git a/src/app/(student)/tools/layout.tsx b/src/app/(student)/tools/layout.tsx new file mode 100644 index 0000000..8da8414 --- /dev/null +++ b/src/app/(student)/tools/layout.tsx @@ -0,0 +1,8 @@ +import { redirect } from "next/navigation"; + +// Toolbox ещё в доработке: на проде скрыт (флаг не задан) — прямой заход на +// /tools/* уводит на дашборд. На staging выставлен TOOLBOX_VISIBLE=true. +export default function ToolsLayout({ children }: { children: React.ReactNode }) { + if (process.env.TOOLBOX_VISIBLE !== "true") redirect("/dashboard"); + return <>{children}; +}