Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
fix #5

现在不再允许部分 Web 快捷键
修复 CompCard 默认展开模式下第一次收起动画缺失的问题
改进 CI 逻辑,分离了开发 CI 和发版 CI
  • Loading branch information
Jim-Lin-4549 committed Jan 29, 2025
1 parent 03708ae commit 1c6c53c
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 93 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'Build App for Development'

on:
push:
branches:
- dev
- beta
- release

jobs:
build-app:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: install Rust Nightly
uses: dtolnay/rust-toolchain@nightly

- name: install frontend dependencies
run: |
npm install -g pnpm
pnpm install
- name: build
run: pnpm tauri build

- name: upload
uses: actions/upload-artifact@v4
with:
name: Windows Embedded App
path: src-tauri/target/release/Plain_Craft_Launcher_2_Nova.exe
if-no-files-found: error
retention-days: 7

- name: upload
uses: actions/upload-artifact@v4
with:
name: Windows Bundled Installer
path: src-tauri/target/release/bundle/
if-no-files-found: error
retention-days: 7
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: 'publish'
name: 'Publish App'

on:
push:
branches:
- release
- beta
- dev
- build/dev
- build/beta
- build/release

# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release.
# This workflow will trigger on each push to the build branchs to create or update a GitHub release, build your app, and upload the artifacts to the release.

jobs:
publish-tauri:
Expand Down
62 changes: 31 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"name": "pcl2-nova-app",
"private": true,
"version": "0.1.1",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-opener": "^2",
"vue": "^3.5.13"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.0.0",
"@tailwindcss/vite": "^4.0.0",
"@tauri-apps/cli": "^2",
"@vitejs/plugin-vue": "^5.2.1",
"autoprefixer": "^10.4.20",
"daisyui": "5.0.0-beta.2",
"postcss": "^8.4.49",
"sass": "^1.83.4",
"sass-loader": "^16.0.4",
"tailwindcss": "^4.0.0",
"typescript": "~5.6.2",
"vite": "^6.0.11",
"vue-router": "^4.5.0",
"vue-tsc": "^2.1.10"
}
"name": "pcl2-nova-app",
"private": true,
"version": "0.1.1",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-opener": "^2",
"vue": "^3.5.13"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.0.0",
"@tailwindcss/vite": "^4.0.0",
"@tauri-apps/cli": "^2",
"@vitejs/plugin-vue": "^5.2.1",
"autoprefixer": "^10.4.20",
"daisyui": "5.0.0-beta.2",
"postcss": "^8.4.49",
"sass": "^1.83.4",
"sass-loader": "^16.0.4",
"tailwindcss": "^4.0.0",
"typescript": "~5.6.2",
"vite": "^6.0.11",
"vue-router": "^4.5.0",
"vue-tsc": "^2.1.10"
}
}
File renamed without changes
4 changes: 2 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Plain Craft Launcher 2 Nova Dev",
"version": "0.1.1",
"productName": "Plain Craft Launcher 2 Nova Stable",
"version": "0.1.2",
"identifier": "nova.pcl2.app",
"build": {
"beforeDevCommand": "pnpm dev",
Expand Down
20 changes: 18 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@ import router from "./modules/ModRouter.ts";

createApp(App).use(router).mount("#app");

window.addEventListener("contextmenu", (e: MouseEvent) => e.preventDefault());

import "./assets/tailwind.css";
import "./assets/style.css";

(function () {
window.oncontextmenu = (e: MouseEvent) => e.preventDefault();
window.onkeydown = (e: KeyboardEvent) => {
// 禁用刷新:[F5, Ctrl + R, Ctrl + Shift + R]
if (e.key === "F5" || (e.ctrlKey && e.key.toLowerCase() === "r") || (e.ctrlKey && e.shiftKey && e.key.toLowerCase() === "r")) {
e.preventDefault();
}
// 禁用历史切换:Alt + [↑, ↓, ←, →]
if (e.altKey && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key)) {
e.preventDefault();
}
// 禁用在构建中的 DevTools
if (e.key === "F12" || (e.ctrlKey && e.shiftKey && e.key.toLowerCase() === "i")) {
e.preventDefault();
}
};
})();
4 changes: 4 additions & 0 deletions src/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "0.1.2",
"channel": "Stable"
}
38 changes: 25 additions & 13 deletions src/ui/components/CompCard.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
<script setup lang="ts">
import { ref } from "vue";
import { onMounted, ref } from "vue";
const props = defineProps<{
title?: string;
canSwap?: boolean;
isSwapped?: boolean;
}>();
const yuncard = ref<HTMLDivElement>();
const isCardOpen = ref<boolean>(props.canSwap ? (props.isSwapped ? false : true) : true);
const toggleCard = () => {
if (!props.canSwap || yuncard.value == null) return;
isCardOpen.value = !isCardOpen.value;
const cardEl = ref<HTMLDivElement>();
const isCardOpen = ref<boolean>(props.canSwap ? !props.isSwapped : true);
const loadCardHeight = (forceFlow?: boolean) => {
if (cardEl.value == null) return;
switch (isCardOpen.value) {
case true:
yuncard.value.style.height = "auto";
const { height } = yuncard.value.getBoundingClientRect();
yuncard.value.style.height = "48px";
yuncard.value.offsetHeight; // force reflow
yuncard.value.style.height = `${height}px`;
cardEl.value.style.height = "auto";
const { height } = cardEl.value.getBoundingClientRect();
cardEl.value.style.height = "48px";
if (forceFlow) {
cardEl.value.offsetHeight; // force reflow
}
cardEl.value.style.height = `${height}px`;
break;
case false:
yuncard.value.style.height = "48px";
cardEl.value.style.height = "48px";
}
};
const toggleCard = () => {
if (!props.canSwap) return;
isCardOpen.value = !isCardOpen.value;
loadCardHeight(true);
};
onMounted(() => {
loadCardHeight();
});
</script>

<template>
Expand All @@ -32,7 +44,7 @@
:class="{
swapped: !isCardOpen,
}"
ref="yuncard">
ref="cardEl">
<div
class="yun-card__top"
:class="{
Expand Down
6 changes: 4 additions & 2 deletions src/ui/layouts/LayoutHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import CompRadioButton from "../components/CompRadioButton.vue";
import { ModEventBus } from "../../modules/ModEventBus.ts";
import { useRoute } from "vue-router";
import metadata from "../../metadata.json"
const AppWindow = getCurrentWindow();
const $route = useRoute();
const { channel } = metadata;
const handleNavigate = (path: string) => {
ModEventBus.emit("router:push", path);
};
Expand All @@ -27,7 +29,7 @@
<span class="ml-6 mr-1 text-2xl tracking-wide">PCL II</span>
<span class="badge px-1.5 rounded-sm mx-2">Nova</span>
<!-- <span class="badge badge-warning text-black px-1.5 rounded-sm translate-y-[1px]">Beta</span> -->
<span class="badge badge-warning text-black px-1.5 rounded-sm">Dev</span>
<span class="badge badge-warning text-black px-1.5 rounded-sm" v-if="channel !== 'Stable'">{{ channel }}</span>
</section>
<!-- NavigateButtons Align=Center -->
<section class="flex gap-4 mr-4">
Expand Down
53 changes: 15 additions & 38 deletions src/ui/views/others/ViewAbout.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<script setup lang="ts">
import CompButton from "../../components/CompButton.vue";
import CompCard from "../../components/CompCard.vue";
import CompListItem from "../../components/CompListItem.vue";
import metadata from "../../../metadata.json"
const $jsWindow = window;
const { channel, version } = metadata;
</script>

<template>
Expand All @@ -13,8 +19,8 @@
<div class="flex">
<CompListItem
text="Plain Craft Launcher II: Nova"
desp="当前版本:0.1.0-nightly.2(Dev 渠道)"
imgSrc="/PCLNova.Dev.png" />
:desp="`当前版本:${version}(${channel} 渠道)`"
:imgSrc="`/PCLNova.${channel}.png`" />
</div>
</section>
</CompCard>
Expand All @@ -25,42 +31,13 @@
</CompCard>
<CompCard title="版权" can-swap is-swapped>
<article class="w-full px-4 flex flex-col gap-2">
<p>
PCL2.Nova.App 开源项目(以下简称 Nova 开源项目)及其<b>官方</b>衍生程序
<br />均遵循 GNU General Public License 3.0 (GPLv3) 协议开源,并在此基础上附加以下条款:
</p>
<ul>
1. 基于 Nova 开源项目做小修改时,可以不对修改后的代码开源,但需要明确在软件内提供指向 Nova
开源项目的链接(末尾附),并添加 Nova开源项目原作者的署名。
</ul>
<ul>
2. 基于 Nova 开源项目做大量修改,或者进行二次开发时,需要对修改后的代码开源,但不一定需要使用 GPLv3
许可证。同时,需要明确在软件内提供指向 Nova 开源项目的链接(末尾附),并添加 Nova 开源项目原作者的署名。
</ul>
<ul>
3. 如果选择在 GitHub 上开源代码,对 Nova 开源项目仓库的 Fork 可以 视为 “指向 Nova 开源项目的链接”。
</ul>
<ul>
4. 无论修改体量如何,不应当制作 Nova
开源项目中需要赞助才能获取的功能,或与其相似的功能。项目作者建议您在计划开发此类内容前先询 问作者以确认是否触及此条款。
</ul>
<ul>
5. 修改之后的版本不得用于商业用途,无论是否开源。
</ul>
<ul>
6. 不得以任何方式让原作者为您或您的使用做任何担保。
</ul>
<ul>
7.
修改之后的版本如果开源,需要包含此附加协议,并不得修改其条款细则。新项目使用的协议不同时可修改位于附加许可证开头的协议说明。
</ul>
<br />
<hr />
<br />
<p>
附:Nova 开源项目链接为
<kbd class="kbd kbd-sm -translate-y-0.25 select-text!">https://github.com/PCL-Community/PCL2.Nova.App</kbd>
</p>
<p>PCL2.Nova.App 开源项目及其官方衍生程序均遵循 GNU General Public License 3.0 (GPLv3)<br />协议开源。</p>
<section class="mt-2 flex gap-4">
<CompButton class="w-36" @click="$jsWindow.open('https://github.com/PCL-Community/PCL2.Nova.App')"
>查看源代码</CompButton
>
<CompButton class="w-36" @click="$jsWindow.open('https://www.gnu.org/licenses/gpl-3.0.html')">查看许可证</CompButton>
</section>
</article>
</CompCard>
<CompCard title="开源项目使用说明" can-swap is-swapped>
Expand Down

0 comments on commit 1c6c53c

Please sign in to comment.