Skip to content

Commit

Permalink
style: add fancy image assets
Browse files Browse the repository at this point in the history
  • Loading branch information
3Shain committed Mar 6, 2023
1 parent 5954b08 commit c80eca6
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 21 deletions.
8 changes: 4 additions & 4 deletions build-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ const { IconIcns } = require("@shockpkg/icon-encoder");
// check if file exists
if (
fs.existsSync(
path.resolve(process.cwd(), "src", "icons", "appIcon.png")
path.join(process.cwd(), config.modes.window.icon)
)
) {
const iconFile = await fs.readFile(
path.resolve(process.cwd(), "src", "icons", "appIcon.png")
path.join(process.cwd(), config.modes.window.icon)
);
icns.addFromPng(iconFile, ["ic09"], raw);
// icns.addFromPng(iconFile, ['ic07'], raw);
Expand Down Expand Up @@ -194,9 +194,9 @@ PATH_LAUNCH="$(dirname "$CONTENTS_DIR")" exec "$SCRIPT_DIR/${appname}" --path="$
<key>CFBundleIdentifier</key>
<string>${config.applicationId}</string>
<key>CFBundleName</key>
<string>${pkg.name}</string>
<string>${config.modes.window.title}</string>
<key>CFBundleDisplayName</key>
<string>${config.cli.binaryName}</string>
<string>${config.modes.window.title}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions neutralino.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/neutralinojs/neutralinojs/main/schemas/neutralino.config.schema.json",
"applicationId": "com.3s.yaagl",
"applicationId": "com.3shain.yaagl",
"version": "1.0.0",
"defaultMode": "window",
"port": 0,
Expand Down Expand Up @@ -36,7 +36,7 @@
"maximize": false,
"hidden": true,
"resizable": false,
"icon": "/src/icons/appIcon.png",
"icon": "/src/icons/Paimon.cr.png",
"exitProcessOnClose": false
}
},
Expand Down
7 changes: 4 additions & 3 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ export async function createApp() {
aria2,
});
// return createCommonUpdateUI(async function *(){
// yield ['setStateText','progressing'];
// yield ['setStateText','测试进度'];
// for(let i=0;i<=100;i++) {
// yield ['setProgress', i];
// await wait(1000);
// await wait(50);
// }
// yield ['setUndeterminedProgress'];
// await wait(10000);
// await wait(2000);
// yield ['setStateText','完成'];
// });
if (!latest) {
if (
Expand Down
Binary file added src/assets/Nahida.cr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 21 additions & 12 deletions src/common-update-ui.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Button, Progress, ProgressIndicator, Center } from "@hope-ui/solid";
import { Box, VStack } from "@hope-ui/solid";
import { Box, VStack, Image } from "@hope-ui/solid";
import { createSignal, onMount, Show } from "solid-js";
import { fatal, log, shutdown, wait } from "./utils";
import s from "./assets/Nahida.cr.png";

export function createCommonUpdateUI(program: () => CommonUpdateProgram) {
let confirmRestart: (v: any) => void;
Expand Down Expand Up @@ -33,9 +34,11 @@ export function createCommonUpdateUI(program: () => CommonUpdateProgram) {
await shutdown();
// await wait(1000);
// HACK
if(import.meta.env.PROD) {
if (import.meta.env.PROD) {
const app = await Neutralino.os.getEnv("PATH_LAUNCH");
await Neutralino.os.execCommand(`open "${app}"`, {background:true});
await Neutralino.os.execCommand(`open "${app}"`, {
background: true,
});
Neutralino.app.exit(0);
} else {
Neutralino.app.restartProcess();
Expand All @@ -48,16 +51,22 @@ export function createCommonUpdateUI(program: () => CommonUpdateProgram) {
return (
<Center h="100vh" w="100vw">
<VStack alignItems="stretch" spacing="$8" w="80vw">
<Box bg="transparent" h="40vh" w="100%"></Box>
<Center>
<Image boxSize={280} src={s}></Image>
</Center>
<h1 style="text-align: center">{statusText()}</h1>
<Show
when={!done()}
fallback={<Button onClick={confirmRestart!}>重启以完成安装</Button>}
>
<Progress value={progress()} indeterminate={progress() == 0}>
<ProgressIndicator animated striped />
</Progress>
</Show>
<Box height={100}>
<Show
when={!done()}
fallback={
<Center><Button onClick={confirmRestart!}>重启以完成安装</Button></Center>
}
>
<Progress value={progress()} indeterminate={progress() == 0}>
<ProgressIndicator animated striped />
</Progress>
</Show>
</Box>
</VStack>
</Center>
);
Expand Down
Binary file added src/icons/Paimon.cr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ if (typeof Neutralino == "undefined") {
console.log(`This app doesn't work on browser.`);
} else {
Neutralino.init();
if (import.meta.env.PROD) {
document.addEventListener("contextmenu", (event) => event.preventDefault());
}
createApp()
.then((UI) => {
render(
Expand Down

0 comments on commit c80eca6

Please sign in to comment.