跳转到内容
项目模板·Pro

Vite + React + TypeScript

用 React 和 TypeScript 写的习惯打卡应用,基于 Vite 8:每周网格、连续天数、一个自定义 hook 和一个测试。需要带 Node.js 的 Linux 环境;首次 npm install 约下载 25 个包(约 80 MB)。

安装它需要 PocketCode Pro。

如果你的 Android 设备上装了 PocketCode,这会在应用里打开此页面。

预览

文件

README.md
index.html
package-lock.json
package.json
public/favicon.svg
src/App.tsx
src/index.css
src/main.tsx
src/useLocalStorage.ts
src/week.ts
test/week.test.ts
tsconfig.json
vite.config.ts

README.md

# Habit tracker: Vite + React + TypeScript A small React app in TypeScript, built with Vite: a weekly grid of habits you tick off day by day, with a streak counter. Habits are saved in the browser (localStorage). It shows the usual pieces of a React project: components, state, a custom hook, typed data and a test. ## Run it in PocketCode You need the app's Linux environment with Node.js 20.19 or newer (the Developer pack in Terminal › Linux includes Node.js and npm). 1. Open the terminal in this project's folder (Open Terminal Here, in the editor menu). 2. Install the dependencies. The first time downloads about 25 packages (around 80 MB on disk) and needs internet: ```sh npm install ``` 3. Start the development server: ```sh npm run dev ``` 4. Open http://localhost:5173 in the DevBrowser (or in the phone's browser). Saving a file updates the page. Stop the server with Ctrl+C in the terminal. ## Other commands | Command | What it does | |---|---| | `npm run build` | Type-checks with `tsc` and writes the production build to `dist/` | | `npm run preview` | Serves `dist/` on http://localhost:4173 | | `npm run typecheck` | Only the type check | | `npm test` | Tests for `src/week.ts` with Node's test runner (Node 22.18 or newer) | ## Where things are | Path | What it does | |---|---| | `index.html` | The page Vite serves; it loads `src/main.tsx` | | `src/App.tsx` | The app: form, weekly grid, streaks |

此预览已截短。安装后可获得完整内容。

1.0.0 的变更

首个版本。

相关

Next.js + Tailwind + i18nPro项目模板Next.js 15 项目,带 next-intl 和 Tailwind CSS,在 /en 和 /es 提供一个英语和西班牙语页面。深色模式跟随系统。需要带 Node.js 的 Linux 环境;首次 npm install 约下载 400 MB。Vite + Vue + TypeScriptPro项目模板用 Vue 3 和 TypeScript 写的专注计时器,基于 Vite 8:专注时段、休息、今日合计、两个 composable 和一个测试。需要带 Node.js 的 Linux 环境;首次 npm install 约下载 50 个包(约 85 MB)。Vite + Svelte + TypeScriptPro项目模板用 Svelte 5 和 TypeScript 写的记忆卡片,基于 Vite 8。每张卡片在五个莱特纳盒子之间移动,到期时再次出现。需要带 Node.js 的 Linux 环境;首次 npm install 约下载 45 个包(约 75 MB)。纯 JavaScript 待办清单Pro项目模板用纯 JavaScript 模块写的待办清单:添加、原地编辑、勾选、筛选、清除已完成,数据保存在 localStorage。逻辑部分带有 Node 内置测试运行器的测试。在 DevBrowser 和应用自带的 Node.js 中运行,不需要 Linux。按钮(React + Tailwind)免费按钮TypeScript 按钮,提供主要和次要两种样式、清晰可见的焦点环,以及会同时设置 aria-busy 的加载圈。次要样式带有深色模式配色。静态落地页Pro项目模板纯 HTML 和 CSS 编写的单页网站:带折叠菜单的页头、首屏、功能网格、常见问题和页脚。颜色跟随系统的浅色或深色模式。无需构建,也不需要 Linux:打开 index.html,点地球图标即可。