Skip to content

Commit 127c305

Browse files
authored
Merge pull request #10 from qianmoQ/dev-25.0.0
feat (core): 拆分 Modal 为独立组件
2 parents fbb8859 + b5d89a1 commit 127c305

File tree

8 files changed

+516
-221
lines changed

8 files changed

+516
-221
lines changed

.github/workflows/docs.yml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,30 @@
1-
name: Publish Docs
1+
name: Publish docs via GitHub Pages
22

33
on:
44
push:
5+
pull_request:
6+
types: [closed]
7+
workflow_dispatch:
58

69
jobs:
7-
test:
10+
deploy:
811
runs-on: ubuntu-latest
912
strategy:
1013
matrix:
1114
node-version: [ 18.x ]
1215

1316
steps:
1417
- uses: actions/checkout@v3
15-
with:
16-
fetch-depth: 0
1718

1819
- name: Use Node.js ${{ matrix.node-version }}
1920
uses: actions/setup-node@v3
2021
with:
2122
node-version: ${{ matrix.node-version }}
2223

23-
- name: Install pnpm
24-
uses: pnpm/action-setup@v2
25-
with:
26-
version: 8
27-
28-
- name: Get pnpm store directory
29-
shell: bash
30-
run: |
31-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
32-
33-
- uses: actions/cache@v3
34-
name: Setup pnpm cache
35-
with:
36-
path: ${{ env.STORE_PATH }}
37-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38-
restore-keys: |
39-
${{ runner.os }}-pnpm-store-
40-
4124
- name: Install dependencies
42-
run: pnpm install
43-
44-
- name: Link package globally
45-
run: |
46-
pnpm link --global
47-
pnpm link --global pageforge
25+
run: npm install pageforge -g
4826

49-
- name: Test build command
27+
- name: Build
5028
run: |
5129
cd docs
5230
pageforge build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ dist-ssr
2525
pnpm-lock.yaml
2626
*.csv
2727
*.json
28+
!config*.json

config/config.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"log_directory": null,
3+
"auto_clear_logs": true,
4+
"keep_log_days": 30,
5+
"theme": "system",
6+
"plugins": [
7+
{
8+
"enabled": true,
9+
"execute_home": null,
10+
"extensions": [],
11+
"language": "python2",
12+
"before_compile": null,
13+
"after_compile": null,
14+
"run_command": null,
15+
"template": null
16+
}
17+
]
18+
}

src/components/About.vue

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
<template>
2-
<div class="fixed inset-0 backdrop-blur-sm bg-white/20 dark:bg-gray-900/20 flex items-center justify-center z-50 transition-all duration-300 ease-out"
3-
:class="{ 'opacity-0': !isVisible, 'opacity-100': isVisible }"
4-
@click.self="$event.preventDefault()">
5-
<div
6-
class="bg-white/95 dark:bg-gray-800/95 backdrop-blur-md rounded-xl shadow-2xl w-4xl p-6 transform transition-all duration-300 ease-out border border-white/20 dark:border-gray-700/30"
7-
:class="{
8-
'scale-95 opacity-0 translate-y-4': !isVisible,
9-
'scale-100 opacity-100 translate-y-0': isVisible
10-
}">
11-
12-
<div class="flex items-center justify-between mb-6">
13-
<h2 class="text-xl font-bold text-gray-900 dark:text-white">关于 CodeForge</h2>
14-
<!-- 关闭按钮 -->
15-
<div class="flex justify-end mb-4">
16-
<button
17-
class="text-gray-400 hover:cursor-pointer dark:hover:text-gray-200 transition-all duration-200 hover:scale-110 rounded-full p-1 hover:bg-gray-300 dark:hover:bg-gray-700"
18-
@click="closeAbout">
19-
<X class="w-5 h-5"></X>
20-
</button>
21-
</div>
22-
</div>
23-
2+
<Modal v-model:show="isVisible" title="关于 CodeForge" size="3xl" :close-on-backdrop="false" :close-on-esc="false" @close="closeAbout">
3+
<div class="space-y-6">
244
<!-- 应用图标和标题 -->
255
<div class="text-center mb-6">
266
<div
@@ -76,22 +56,24 @@
7656
</span>
7757
</div>
7858
</div>
59+
</div>
7960

61+
<template #footer>
8062
<!-- 底部信息 -->
81-
<div class="border-t border-gray-200/50 dark:border-gray-600/50 pt-4 transition-all duration-600 delay-600">
63+
<div class="border-gray-200/50 dark:border-gray-600/50 pt-4 transition-all duration-600 delay-600">
8264
<p class="text-xs text-center text-gray-500 dark:text-gray-400">
8365
© 2025 Devlive Community. 专为开发者打造的代码执行工具
8466
</p>
8567
</div>
86-
</div>
87-
</div>
68+
</template>
69+
</Modal>
8870
</template>
8971

9072
<script setup lang="ts">
9173
import { nextTick, onMounted, ref, watch } from 'vue'
9274
import { invoke } from '@tauri-apps/api/core'
9375
import { open } from '@tauri-apps/plugin-shell'
94-
import { X } from 'lucide-vue-next'
76+
import Modal from '../ui/Modal.vue'
9577
9678
interface AppInfo
9779
{

src/components/Settings.vue

Lines changed: 86 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,114 @@
11
<template>
2-
<div class="fixed inset-0 backdrop-blur-sm bg-white/20 dark:bg-gray-900/20 flex items-center justify-center z-50 transition-all duration-300 ease-out"
3-
:class="{ 'opacity-0': !isVisible, 'opacity-100': isVisible }">
4-
<div
5-
class="bg-white/95 dark:bg-gray-800/95 backdrop-blur-md rounded-xl shadow-2xl w-6xl h-screen p-6 transform transition-all duration-300 ease-out border border-white/20 dark:border-gray-700/30 max-h-[80vh] overflow-y-auto"
6-
:class="{
7-
'scale-95 opacity-0 translate-y-4': !isVisible,
8-
'scale-100 opacity-100 translate-y-0': isVisible
9-
}">
10-
11-
<!-- 头部 -->
12-
<div class="flex items-center justify-between mb-6">
13-
<h2 class="text-xl font-bold text-gray-900 dark:text-white">设置</h2>
14-
<button
15-
@click="closeSettings"
16-
class="text-gray-400 hover:cursor-pointer hover:text-gray-600 dark:hover:text-gray-200 transition-all duration-200 hover:scale-110 rounded-full p-1 hover:bg-gray-200 dark:hover:bg-gray-700">
17-
<X class="w-5 h-5"/>
18-
</button>
19-
</div>
20-
21-
<!-- 日志设置 -->
22-
<div class="mb-6">
23-
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center">
24-
<FileText class="w-5 h-5 mr-2"/>
25-
日志设置
26-
</h3>
27-
28-
<div class="space-y-4">
29-
<!-- 当前日志目录 -->
30-
<div>
31-
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
32-
当前日志目录
33-
</label>
34-
<div class="bg-gray-50 dark:bg-gray-700 rounded-lg p-3 text-sm text-gray-600 dark:text-gray-400 font-mono">
35-
{{ currentLogDir || '加载中...' }}
36-
</div>
37-
</div>
38-
39-
<!-- 修改日志目录 -->
40-
<div>
41-
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
42-
选择新的日志目录
43-
</label>
44-
<div class="flex gap-2">
45-
<input v-model="newLogDir"
46-
type="text"
47-
placeholder="选择或输入日志目录路径"
48-
class="flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm"
49-
readonly/>
50-
51-
<Button type="primary"
52-
:icon-only="true"
53-
:icon="Folder"
54-
@click="selectLogDirectory">
55-
</Button>
56-
</div>
2+
<Modal v-model:show="isVisible" title="设置" size="4xl" :close-on-backdrop="false" :close-on-esc="false" @close="closeSettings">
3+
<!-- 日志设置 -->
4+
<div class="mb-6">
5+
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center">
6+
<FileText class="w-5 h-5 mr-2"/>
7+
日志设置
8+
</h3>
9+
10+
<div class="space-y-4">
11+
<!-- 当前日志目录 -->
12+
<div>
13+
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
14+
当前日志目录
15+
</label>
16+
<div class="bg-gray-50 dark:bg-gray-700 rounded-lg p-3 text-sm text-gray-600 dark:text-gray-400 font-mono">
17+
{{ currentLogDir || '加载中...' }}
5718
</div>
19+
</div>
5820

59-
<!-- 操作按钮 -->
60-
<div class="flex gap-3 pt-0.5">
61-
<Button @click="applyLogDirChange"
62-
:disabled="!newLogDir || newLogDir === currentLogDir"
63-
type="secondary">
64-
应用更改
65-
</Button>
66-
<Button @click="openLogDirectory" type="secondary">
67-
打开日志目录
68-
</Button>
69-
<Button @click="resetLogDirectory"
70-
class="cursor-pointer px-4 py-2 bg-orange-500 hover:bg-orange-600 text-white text-sm font-medium rounded-md transition-colors">
71-
重置为默认
21+
<!-- 修改日志目录 -->
22+
<div>
23+
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
24+
选择新的日志目录
25+
</label>
26+
<div class="flex gap-2">
27+
<input v-model="newLogDir"
28+
type="text"
29+
placeholder="选择或输入日志目录路径"
30+
class="flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm"
31+
readonly/>
32+
33+
<Button type="primary"
34+
:icon-only="true"
35+
:icon="Folder"
36+
@click="selectLogDirectory">
7237
</Button>
7338
</div>
39+
</div>
40+
41+
<!-- 操作按钮 -->
42+
<div class="flex gap-3 pt-0.5">
43+
<Button @click="applyLogDirChange"
44+
:disabled="!newLogDir || newLogDir === currentLogDir"
45+
type="secondary">
46+
应用更改
47+
</Button>
48+
<Button @click="openLogDirectory" type="secondary">
49+
打开日志目录
50+
</Button>
51+
<Button @click="resetLogDirectory"
52+
class="cursor-pointer px-4 py-2 bg-orange-500 hover:bg-orange-600 text-white text-sm font-medium rounded-md transition-colors">
53+
重置为默认
54+
</Button>
55+
</div>
7456

75-
<!-- 日志文件列表 -->
76-
<div v-if="logFiles.length > 0">
77-
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
78-
最近的日志文件
79-
</label>
80-
<div class="bg-gray-50 dark:bg-gray-700 rounded-lg p-3 max-h-32 overflow-y-auto">
81-
<div v-for="file in logFiles.slice(0, 5)" :key="file"
82-
class="text-sm text-gray-600 dark:text-gray-400 font-mono py-1 hover:text-blue-600 dark:hover:text-blue-400 cursor-pointer"
83-
@click="openLogFile(file)">
84-
{{ file }}
85-
</div>
57+
<!-- 日志文件列表 -->
58+
<div v-if="logFiles.length > 0">
59+
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
60+
最近的日志文件
61+
</label>
62+
<div class="bg-gray-50 dark:bg-gray-700 rounded-lg p-3 max-h-32 overflow-y-auto">
63+
<div v-for="file in logFiles.slice(0, 5)" :key="file"
64+
class="text-sm text-gray-600 dark:text-gray-400 font-mono py-1 hover:text-blue-600 dark:hover:text-blue-400 cursor-pointer"
65+
@click="openLogFile(file)">
66+
{{ file }}
8667
</div>
8768
</div>
8869
</div>
8970
</div>
71+
</div>
9072

91-
<!-- 日志管理 -->
92-
<div class="mb-6">
93-
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center">
94-
<Settings2 class="w-5 h-5 mr-2"/>
95-
日志管理
96-
</h3>
97-
98-
<div class="space-y-4">
99-
<!-- 清理旧日志 -->
100-
<div>
101-
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
102-
自动清理日志
103-
</label>
104-
<div class="flex items-center gap-3">
105-
<Select v-model="keepDays"
106-
class="w-36"
107-
:options="keepDaysOptions"
108-
placeholder="选择保留天数">
109-
</Select>
110-
<Button type="danger" @click="clearLogs">
111-
立即清理
112-
</Button>
113-
</div>
73+
<!-- 日志管理 -->
74+
<div class="mb-6">
75+
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center">
76+
<Settings2 class="w-5 h-5 mr-2"/>
77+
日志管理
78+
</h3>
79+
80+
<div class="space-y-4">
81+
<!-- 清理旧日志 -->
82+
<div>
83+
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
84+
自动清理日志
85+
</label>
86+
<div class="flex items-center gap-3">
87+
<Select v-model="keepDays"
88+
class="w-36"
89+
:options="keepDaysOptions"
90+
placeholder="选择保留天数">
91+
</Select>
92+
<Button type="danger" @click="clearLogs">
93+
立即清理
94+
</Button>
11495
</div>
11596
</div>
11697
</div>
11798
</div>
118-
</div>
99+
</Modal>
119100
</template>
120101

121102
<script setup lang="ts">
122103
import { nextTick, onMounted, ref } from 'vue'
123104
import { invoke } from '@tauri-apps/api/core'
124105
import { open as openDialog } from '@tauri-apps/plugin-dialog'
125106
import { openPath } from '@tauri-apps/plugin-opener'
126-
import { FileText, Folder, Settings2, X } from 'lucide-vue-next'
107+
import { FileText, Folder, Settings2 } from 'lucide-vue-next'
127108
import Select from '../ui/Select.vue'
128109
import { useToast } from '../plugins/toast'
129110
import Button from '../ui/Button.vue'
111+
import Modal from '../ui/Modal.vue'
130112
131113
const toast = useToast()
132114
const isVisible = ref(false)

src/components/Toast.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<Teleport to="body">
3-
<div class="fixed bottom-4 right-4 z-50 space-y-2 w-96">
3+
<div class="fixed z-[99999] bottom-4 right-4 space-y-2 w-96">
44
<TransitionGroup name="toast"
55
enter-active-class="transition-all duration-300 ease-out"
66
enter-from-class="transform translate-x-full opacity-0"

0 commit comments

Comments
 (0)