Skip to content

Commit 3a09efe

Browse files
committed
feat: add landing page for first-time visitors + install guide
Landing Page (/welcome): - Hero with story intro, feature cards, how-it-works steps, CTA - First visit auto-redirects from / to /welcome (localStorage check) - "開始修煉" sets visited flag and enters main app - No Navbar on landing page for immersive feel Guide Page (/guide): - 4 tabs: Vim 基礎 / Neovim / LazyVim / 熱門 Plugin - Install commands with terminal-styled code blocks - Plugin tab loads from lazyvim_plugins.json with practice links - External links to official docs for advanced content Navbar updates: - Added "指南" (/guide) and "關於" (/welcome) links
1 parent 76192ef commit 3a09efe

6 files changed

Lines changed: 553 additions & 5 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Landing Page + 安裝指南設計
2+
3+
## 1. Landing Page
4+
5+
### 進入邏輯
6+
- 首次訪問(`localStorage``vimdojo_visited` key)→ 顯示 Landing
7+
- 回訪者 → 直接進 Dashboard
8+
- Nav 加「關於」連結可隨時回看
9+
10+
### 頁面結構(單頁滾動)
11+
12+
**Section 1: Hero**
13+
- 故事引言:「歡迎來到虛擬終端,修煉者。」
14+
- 副標:互動式 Vim 學習平台 — 從零開始掌握鍵道
15+
- CTA 按鈕:「開始修煉」
16+
17+
**Section 2: 三大特色**(卡片排列)
18+
- 從零打造的 Vim 引擎 — 100+ 指令,瀏覽器即練
19+
- 167 道練習題 — Vim 核心 + LazyVim 插件
20+
- RPG 養成系統 — 等級、技能樹、成就解鎖
21+
22+
**Section 3: 體驗預覽**
23+
- 一張編輯器截圖或動態示意
24+
- 簡述操作流程:看題 → 打字 → 提交 → 獲得 XP
25+
26+
**Section 4: 快速開始**
27+
- 「開始修煉」按鈕 → 設 localStorage + 跳轉 Dashboard
28+
- 「安裝 Vim/Neovim 指南」連結 → /guide
29+
30+
### 路由
31+
- `/welcome` — Landing Page
32+
- `/` — Dashboard(原本不變)
33+
- App.tsx 在 `/` 路由加 localStorage 檢查,首次導向 `/welcome`
34+
35+
## 2. 安裝指南頁
36+
37+
### 路由
38+
- `/guide` — 指南頁
39+
- Nav 加入「指南」連結
40+
41+
### 頁面結構
42+
43+
**Tab 1: Vim 基礎**
44+
- 什麼是 Vim、為什麼學 Vim(2-3 句)
45+
- 安裝指令:macOS (`brew install vim`)、Linux (`apt install vim`)、Windows (下載連結)
46+
- 基本操作速覽:模式切換、存檔退出
47+
- 連結:官方文件、vimtutor
48+
49+
**Tab 2: Neovim**
50+
- Vim → Neovim 的差異(1-2 句)
51+
- 安裝指令:brew/apt/winget
52+
- 基本設定:`init.lua` 位置
53+
- 連結:neovim.io
54+
55+
**Tab 3: LazyVim**
56+
- 什麼是 LazyVim(預設好的 Neovim 設定)
57+
- 安裝步驟(3 步:備份 → clone → 啟動)
58+
- Plugin 管理方式(Lazy.nvim)
59+
- 連結:lazyvim.org
60+
61+
**Tab 4: 熱門 Plugin**
62+
- 列出本站練習涵蓋的 plugin
63+
- 每個 plugin:名稱、一句描述、關鍵快捷鍵、「去練習」連結
64+
- 資料從 `lazyvim_plugins.json` 載入
65+
66+
### 設計原則
67+
- 站內提供足夠起步資訊(安裝指令可直接複製)
68+
- 進階內容連結官方文件
69+
- Plugin 教學和練習題連結,學完可以馬上練

vimdao-web/src/App.tsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BrowserRouter, Routes, Route } from 'react-router-dom'
1+
import { BrowserRouter, Routes, Route, Navigate, useLocation } from 'react-router-dom'
22
import Dashboard from './components/Dashboard/Dashboard'
33
import HomePage from './components/RPG/HomePage'
44
import ChallengeList from './components/Challenge/ChallengeList'
@@ -7,14 +7,28 @@ import CommandRef from './components/CommandRef/CommandRef'
77
import Library from './components/Library/Library'
88
import QuizList from './components/Quiz/QuizList'
99
import QuizView from './components/Quiz/QuizView'
10+
import LandingPage from './components/Landing/LandingPage'
11+
import GuidePage from './components/Guide/GuidePage'
1012
import Navbar from './components/Layout/Navbar'
1113

12-
export default function App() {
14+
function AppLayout() {
15+
const location = useLocation()
16+
const hideNavbar = location.pathname === '/welcome'
17+
1318
return (
14-
<BrowserRouter basename={import.meta.env.BASE_URL}>
15-
<Navbar />
19+
<>
20+
{!hideNavbar && <Navbar />}
1621
<Routes>
17-
<Route path="/" element={<Dashboard />} />
22+
<Route
23+
path="/"
24+
element={
25+
localStorage.getItem('vimdojo_visited')
26+
? <Dashboard />
27+
: <Navigate to="/welcome" replace />
28+
}
29+
/>
30+
<Route path="/welcome" element={<LandingPage />} />
31+
<Route path="/guide" element={<GuidePage />} />
1832
<Route path="/path" element={<HomePage />} />
1933
<Route path="/practice" element={<ChallengeList />} />
2034
<Route path="/challenge/:id" element={<ChallengeView />} />
@@ -23,6 +37,14 @@ export default function App() {
2337
<Route path="/lazyvim" element={<QuizList />} />
2438
<Route path="/quiz/:id" element={<QuizView />} />
2539
</Routes>
40+
</>
41+
)
42+
}
43+
44+
export default function App() {
45+
return (
46+
<BrowserRouter basename={import.meta.env.BASE_URL}>
47+
<AppLayout />
2648
</BrowserRouter>
2749
)
2850
}

0 commit comments

Comments
 (0)