From b275a3668b140d9ce4663de646519d2dbd4297e7 Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Tue, 24 Feb 2026 22:41:36 +0800 Subject: refactor: rewrite login and settings pages --- packages/ui-new/src/pages/home-view.tsx | 212 +------------------------------- 1 file changed, 2 insertions(+), 210 deletions(-) (limited to 'packages/ui-new/src/pages/home-view.tsx') diff --git a/packages/ui-new/src/pages/home-view.tsx b/packages/ui-new/src/pages/home-view.tsx index bcee7e6..4f80cb0 100644 --- a/packages/ui-new/src/pages/home-view.tsx +++ b/packages/ui-new/src/pages/home-view.tsx @@ -1,5 +1,5 @@ -import { Calendar, ExternalLink } from "lucide-react"; import { useEffect, useState } from "react"; +import { BottomBar } from "@/components/bottom-bar"; import type { SaturnEffect } from "@/lib/effects/SaturnEffect"; import { useGameStore } from "../stores/game-store"; import { useReleasesStore } from "../stores/releases-store"; @@ -108,125 +108,6 @@ export function HomeView() { } }; - const formatDate = (dateString: string) => { - return new Date(dateString).toLocaleDateString(undefined, { - year: "numeric", - month: "long", - day: "numeric", - }); - }; - - const escapeHtml = (unsafe: string) => { - return unsafe - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); - }; - - const formatBody = (body: string) => { - if (!body) return ""; - - let processed = escapeHtml(body); - - const emojiMap: Record = { - ":tada:": "🎉", - ":sparkles:": "✨", - ":bug:": "🐛", - ":memo:": "📝", - ":rocket:": "🚀", - ":white_check_mark:": "✅", - ":construction:": "🚧", - ":recycle:": "♻️", - ":wrench:": "🔧", - ":package:": "📦", - ":arrow_up:": "⬆️", - ":arrow_down:": "⬇️", - ":warning:": "⚠️", - ":fire:": "🔥", - ":heart:": "❤️", - ":star:": "⭐", - ":zap:": "⚡", - ":art:": "🎨", - ":lipstick:": "💄", - ":globe_with_meridians:": "🌐", - }; - - processed = processed.replace( - /:[a-z0-9_]+:/g, - (match) => emojiMap[match] || match, - ); - - processed = processed.replace(/`([0-9a-f]{7,40})`/g, (_match, hash) => { - return `${hash.substring( - 0, - 7, - )}`; - }); - - processed = processed.replace( - /@([a-zA-Z0-9-]+)/g, - '@$1', - ); - - return processed - .split("\n") - .map((line) => { - line = line.trim(); - - const formatLine = (text: string) => - text - .replace( - /\*\*(.*?)\*\*/g, - '$1', - ) - .replace( - /(?$1', - ) - .replace( - /`([^`]+)`/g, - '$1', - ) - .replace( - /\[(.*?)\]\((.*?)\)/g, - '$1', - ); - - if (line.startsWith("- ") || line.startsWith("* ")) { - return `
  • ${formatLine( - line.substring(2), - )}
  • `; - } - - if (line.startsWith("##")) { - return `

    ${line.replace( - /^#+\s+/, - "", - )}

    `; - } - - if (line.startsWith("#")) { - return `

    ${line.replace( - /^#+\s+/, - "", - )}

    `; - } - - if (line.startsWith("> ")) { - return `
    ${formatLine( - line.substring(2), - )}
    `; - } - - if (line === "") return '
    '; - - return `

    ${formatLine(line)}

    `; - }) - .join(""); - }; - return (
    - {/* Scroll Hint */} - {!releasesStore.isLoading && releasesStore.releases.length > 0 && ( -
    - - Scroll for Updates - - - Scroll for Updates - - -
    - )} - - - {/* Changelog / Updates Section */} -
    -
    -

    - - LATEST UPDATES -

    - - {releasesStore.isLoading ? ( -
    - {Array(3) - .fill(0) - .map((_, i) => ( -
    - ))} -
    - ) : releasesStore.error ? ( -
    - Failed to load updates: {releasesStore.error} -
    - ) : releasesStore.releases.length === 0 ? ( -
    No releases found.
    - ) : ( -
    - {releasesStore.releases.map((release, index) => ( -
    - {/* Timeline Dot */} -
    - -
    -

    - {release.name || release.tagName} -

    -
    - - {formatDate(release.publishedAt)} -
    -
    - - - ))} -
    - )} -
    +
    ); -- cgit v1.2.3-70-g09d2