Spaces:
Running
Running
Download kkndme/frontend/src/components/MiniToolPreview.tsx from Ethscriptions/tz: direct link, hf CLI and curl.
- Browser
- Download file 6.41 kB
-
https://huggingface.co/spaces/Ethscriptions/tz/resolve/main/kkndme/frontend/src/components/MiniToolPreview.tsx
- Command line
-
hf download hf://spaces/Ethscriptions/tz/kkndme/frontend/src/components/MiniToolPreview.tsx
-
curl -L -o MiniToolPreview.tsx https://huggingface.co/spaces/Ethscriptions/tz/resolve/main/kkndme/frontend/src/components/MiniToolPreview.tsx
6.41 kB
| import { useRef, useState } from 'react' | |
| import { Download, RotateCcw, Eraser } from 'lucide-react' | |
| const BASE = import.meta.env.BASE_URL | |
| const SRC = `${BASE}minitool/index.html` | |
| const FEATURES = [ | |
| ['原帖楼层', '1085 楼按原顺序还原,网友提问 + kkndme 回复,可只看楼主、跳楼、搜索'], | |
| ['精华合集', '131 章目录直达,标出已读章节和上次读到的位置'], | |
| ['预测核对 · 理论框架', '123 条预测逐条对答案,43 条理论附原话'], | |
| ['AI 推演', '按他的理论框架推演未来房价:三个根本问题、几条推演结论和反方证据,不构成投资建议'], | |
| ['阅读进度', '原帖楼层、精华合集、预测核对、理论框架各自记住位置,点回该栏目自动回到上次读到的地方,不弹提示'], | |
| ['资料下载', 'PDF 获取方式(看你的笔记 / 私信你),关注作者后才显示'], | |
| ['主题色', '深蓝 #1A4379'], | |
| ] as const | |
| const CHECKS = [ | |
| ['包结构', '首页文件在最外层,6 个文件,类型全部合规'], | |
| ['安全规则', '不联网、无外链、无弹窗、无剪贴板、无内嵌网页'], | |
| ['老手机兼容', '按平台最低要求(Chrome 61)降级'], | |
| ['体积', '约 0.8MB(上限 10MB,建议 2MB 内)'], | |
| ['平台校验脚本', 'PASS · 0 个警告'], | |
| ] as const | |
| export default function MiniToolPreview() { | |
| const ref = useRef<HTMLIFrameElement>(null) | |
| const [key, setKey] = useState(0) | |
| const [tip, setTip] = useState('') | |
| const flash = (s: string) => { | |
| setTip(s) | |
| setTimeout(() => setTip(''), 1600) | |
| } | |
| return ( | |
| <section className="mt-4 grid gap-6 lg:grid-cols-[auto_1fr]"> | |
| {/* 手机预览 */} | |
| <div className="mx-auto w-full max-w-[414px] lg:mx-0 lg:w-[414px]"> | |
| <div className="relative rounded-[46px] bg-[#111] p-3 shadow-2xl ring-1 ring-white/10"> | |
| <div className="absolute left-1/2 top-3 z-10 h-[26px] w-[120px] -translate-x-1/2 rounded-b-2xl bg-[#111]" /> | |
| <iframe | |
| key={key} | |
| ref={ref} | |
| src={SRC} | |
| title="小红书小工具预览" | |
| className="block rounded-[34px] bg-[#ece7dc]" | |
| style={{ width: '100%', height: 780, border: 0 }} | |
| /> | |
| </div> | |
| <div className="mt-3 flex items-center justify-center gap-2"> | |
| <button onClick={() => setKey((k) => k + 1)} className="inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-semibold"> | |
| <RotateCcw size={13} /> | |
| 重新打开 | |
| </button> | |
| <button | |
| onClick={() => { | |
| try { | |
| ref.current?.contentWindow?.localStorage.removeItem('kkndme_reading_progress_v2') | |
| } catch { | |
| /* ignore */ | |
| } | |
| setKey((k) => k + 1) | |
| flash('已清除预览里的阅读进度') | |
| }} | |
| className="inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-semibold" | |
| > | |
| <Eraser size={13} /> | |
| 清除阅读进度 | |
| </button> | |
| </div> | |
| <p className="mt-1 h-4 text-center text-xs text-muted-foreground">{tip}</p> | |
| </div> | |
| {/* 说明 */} | |
| <div className="min-w-0 space-y-4"> | |
| <div className="rounded-xl border border-border bg-card/60 p-4"> | |
| <h3 className="text-base font-black">📱 小红书小工具 · 楼层版</h3> | |
| <p className="mt-1 text-sm leading-relaxed text-muted-foreground"> | |
| 左边就是上传到小红书后的样子,可以直接点、直接滑:翻楼层、读合集、看预测,滑一段后点「重新打开」,首页会出现「上次读到」。 | |
| 预览里没有小红书环境,所以不显示「关注作者」按钮,「资料下载」也直接显示内容;在小红书里打开时,没关注的人只会看到「关注后可查看」。 | |
| </p> | |
| <a | |
| href={`${BASE}dl/kkndme-minitool.zip`} | |
| download="kkndme楼层版-小红书小工具.zip" | |
| className="mt-3 inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-2 text-sm font-bold text-primary-foreground" | |
| > | |
| <Download size={15} /> | |
| 下载小工具离线包(zip · 约 0.8MB) | |
| </a> | |
| <a href="#bbs" className="ml-3 text-xs font-semibold" style={{ color: '#5b8def' }}> | |
| 在浏览器里全屏打开 › | |
| </a> | |
| </div> | |
| <div className="rounded-xl border border-border bg-card/40 p-4"> | |
| <h4 className="text-sm font-bold">里面有什么</h4> | |
| <ul className="mt-2 space-y-1.5 text-sm"> | |
| {FEATURES.map(([k, v]) => ( | |
| <li key={k} className="leading-relaxed"> | |
| <b>{k}</b> | |
| <span className="text-muted-foreground"> — {v}</span> | |
| </li> | |
| ))} | |
| </ul> | |
| </div> | |
| <div className="rounded-xl border border-border bg-card/40 p-4"> | |
| <h4 className="text-sm font-bold">校验结果</h4> | |
| <ul className="mt-2 space-y-1 text-sm"> | |
| {CHECKS.map(([k, v]) => ( | |
| <li key={k}> | |
| <span style={{ color: '#3FA877' }}>✓</span> <b>{k}</b> | |
| <span className="text-muted-foreground"> — {v}</span> | |
| </li> | |
| ))} | |
| <li> | |
| <span style={{ color: '#C9973A' }}>!</span> <b>兼容性 / 性能</b> | |
| <span className="text-muted-foreground"> — 未实测,需要在下面三处验证</span> | |
| </li> | |
| </ul> | |
| </div> | |
| <div className="rounded-xl border border-border bg-card/40 p-4"> | |
| <h4 className="text-sm font-bold">上线前请你验证</h4> | |
| <ol className="mt-2 list-decimal space-y-1 pl-5 text-sm leading-relaxed text-foreground/90"> | |
| <li>把 zip 上传到创服平台,先在模拟器里点一遍(重点看精华合集、各栏目阅读进度、资料下载的关注解锁)</li> | |
| <li>Android 真机扫码打开验证</li> | |
| <li>iPhone 真机扫码打开验证</li> | |
| </ol> | |
| <p className="mt-2 text-xs text-muted-foreground">电脑浏览器里能打开不等于手机上没问题,以真机为准;有问题截图发我。</p> | |
| </div> | |
| </div> | |
| </section> | |
| ) | |
| } | |