修改图标

This commit is contained in:
feie9454 2026-07-18 19:59:39 +08:00
parent 747dcd359a
commit b68bfc6287
19 changed files with 54 additions and 39 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -9,26 +9,19 @@ export const metadata: Metadata = {
description: "随时了解长辈的近况,查看留言、使用动态,给长辈写问候。",
manifest: "/manifest.webmanifest",
icons: {
icon: [
{
url: "/pwa/icon-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
url: "/pwa/icon-512x512.png",
sizes: "512x512",
type: "image/png",
},
],
icon: {
url: "/app-icon.webp",
sizes: "512x512",
type: "image/webp",
},
apple: [
{
url: "/pwa/apple-touch-icon.png",
url: "/pwa/apple-touch-icon.webp",
sizes: "180x180",
type: "image/png",
type: "image/webp",
},
],
shortcut: "/pwa/icon-192x192.png",
shortcut: "/app-icon.webp",
},
appleWebApp: {
capable: true,

View File

@ -1,3 +1,4 @@
import Image from "next/image";
import { redirect } from "next/navigation";
import { AccountAuthForm } from "@/components/account-auth-form";
@ -15,7 +16,14 @@ export default async function LoginPage({ searchParams }: PageProps<"/login">) {
<main className="app-frame" style={{ display: "flex", alignItems: "center" }}>
<section style={{ width: "100%", padding: "28px 22px", display: "flex", flexDirection: "column", gap: 22 }}>
<div>
<div style={{ display: "flex", width: 52, height: 52, alignItems: "center", justifyContent: "center", borderRadius: 14, background: "var(--accent)", color: "#fff", fontSize: 22, fontWeight: 700 }}></div>
<Image
src="/app-icon.webp"
alt="安智伴"
width={52}
height={52}
priority
style={{ display: "block", borderRadius: 14 }}
/>
<h1 style={{ margin: "16px 0 0", fontSize: 24, lineHeight: 1.35 }}> </h1>
<p style={{ margin: "8px 0 0", color: "var(--muted)", fontSize: 13.5, lineHeight: 1.7 }}></p>
</div>

View File

@ -13,21 +13,21 @@ export default function manifest(): MetadataRoute.Manifest {
categories: ["utilities", "lifestyle", "health"],
icons: [
{
src: "/pwa/icon-192x192.png",
src: "/pwa/icon-192x192.webp",
sizes: "192x192",
type: "image/png",
type: "image/webp",
},
{
src: "/pwa/icon-512x512.png",
src: "/pwa/icon-512x512.webp",
sizes: "512x512",
type: "image/png",
type: "image/webp",
},
{
src: "/pwa/icon-maskable-512x512.png",
src: "/pwa/icon-maskable-512x512.webp",
sizes: "512x512",
type: "image/png",
type: "image/webp",
purpose: "maskable",
},
],
};
}
}

View File

@ -1,6 +1,5 @@
{
"lockfileVersion": 1,
"configVersion": 0,
"workspaces": {
"": {
"name": "digital-human-monitor-v2",
@ -31,6 +30,10 @@
"tailwindcss": "^4",
"typescript": "^5",
},
"optionalDependencies": {
"@tailwindcss/oxide-darwin-arm64": "4.2.2",
"lightningcss-darwin-arm64": "1.32.0",
},
},
},
"trustedDependencies": [
@ -208,6 +211,8 @@
"@tailwindcss/oxide": ["@tailwindcss/oxide@4.2.2", "", { "optionalDependencies": { "@tailwindcss/oxide-win32-x64-msvc": "4.2.2" } }, ""],
"@tailwindcss/oxide-darwin-arm64": ["@tailwindcss/oxide-darwin-arm64@4.2.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-iq9Qjr6knfMpZHj55/37ouZeykwbDqF21gPFtfnhCCKGDcPI/21FKC9XdMO/XyBM7qKORx6UIhGgg6jLl7BZlg=="],
"@tailwindcss/oxide-win32-x64-msvc": ["@tailwindcss/oxide-win32-x64-msvc@4.2.2", "", { "os": "win32", "cpu": "x64" }, ""],
"@tailwindcss/postcss": ["@tailwindcss/postcss@4.2.2", "", { "dependencies": { "@alloc/quick-lru": "^5.2.0", "@tailwindcss/node": "4.2.2", "@tailwindcss/oxide": "4.2.2", "postcss": "^8.5.6", "tailwindcss": "4.2.2" } }, ""],
@ -704,6 +709,8 @@
"lightningcss": ["lightningcss@1.32.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-win32-x64-msvc": "1.32.0" } }, ""],
"lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.32.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ=="],
"lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.32.0", "", { "os": "win32", "cpu": "x64" }, ""],
"locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, ""],

View File

@ -36,6 +36,10 @@
"tailwindcss": "^4",
"typescript": "^5"
},
"optionalDependencies": {
"@tailwindcss/oxide-darwin-arm64": "4.2.2",
"lightningcss-darwin-arm64": "1.32.0"
},
"ignoreScripts": [
"sharp",
"unrs-resolver"

BIN
public/app-icon.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

BIN
public/pwa/badge-96x96.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 519 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -3,8 +3,8 @@ self.addEventListener("push", (event) => {
title: "安智伴 家人连线台",
body: "收到一条新的家人留言。",
url: "/",
icon: "/pwa/icon-192x192.png",
badge: "/pwa/badge-96x96.png",
icon: "/pwa/icon-192x192.webp",
badge: "/pwa/badge-96x96.webp",
tag: "digital-human-message",
};
@ -63,4 +63,4 @@ self.addEventListener("notificationclick", (event) => {
},
),
);
});
});

View File

@ -7,7 +7,7 @@ import sharp from "sharp";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const projectRoot = path.resolve(__dirname, "..");
const sourceIconPath = path.join(projectRoot, "icon.png");
const sourceIconPath = path.join(projectRoot, "app", "icon.png");
const pwaOutputDir = path.join(projectRoot, "public", "pwa");
const androidResArg = process.argv.find((arg) =>
@ -25,16 +25,19 @@ function createCircleMask(size) {
`);
}
async function writePng(size, outputPath) {
await sharp(sourceIconPath).resize(size, size).png().toFile(outputPath);
async function writeWebp(size, outputPath) {
await sharp(sourceIconPath)
.resize(size, size)
.webp({ quality: 88, effort: 6 })
.toFile(outputPath);
}
async function writeMaskablePng(size, outputPath) {
async function writeMaskableWebp(size, outputPath) {
const foreground = await sharp(sourceIconPath)
.resize(Math.round(size * 0.82), Math.round(size * 0.82), {
fit: "contain",
})
.png()
.webp({ quality: 88, effort: 6 })
.toBuffer();
await sharp({
@ -51,7 +54,7 @@ async function writeMaskablePng(size, outputPath) {
gravity: "center",
},
])
.png()
.webp({ quality: 88, effort: 6 })
.toFile(outputPath);
}
@ -92,15 +95,15 @@ async function writeAndroidIcons(resDir) {
await mkdir(pwaOutputDir, { recursive: true });
await Promise.all([
writePng(192, path.join(pwaOutputDir, "icon-192x192.png")),
writePng(512, path.join(pwaOutputDir, "icon-512x512.png")),
writePng(180, path.join(pwaOutputDir, "apple-touch-icon.png")),
writePng(96, path.join(pwaOutputDir, "badge-96x96.png")),
writeMaskablePng(512, path.join(pwaOutputDir, "icon-maskable-512x512.png")),
writeWebp(192, path.join(pwaOutputDir, "icon-192x192.webp")),
writeWebp(512, path.join(pwaOutputDir, "icon-512x512.webp")),
writeWebp(180, path.join(pwaOutputDir, "apple-touch-icon.webp")),
writeWebp(96, path.join(pwaOutputDir, "badge-96x96.webp")),
writeMaskableWebp(512, path.join(pwaOutputDir, "icon-maskable-512x512.webp")),
]);
if (androidResDir) {
await writeAndroidIcons(androidResDir);
}
console.log("Icons generated successfully.");
console.log("Icons generated successfully.");