From c55371adfe78fbdf11c0b81365616a96886f17a6 Mon Sep 17 00:00:00 2001 From: rookie4show Date: Mon, 18 May 2026 15:31:03 +0800 Subject: [PATCH] feat: add onmyoji-flow migration prompt --- src/App.vue | 62 +++++++++++++++++++++++++++++++++++++- src/components/Toolbar.vue | 15 ++++++++- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index 6123a01..e73ab2c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,6 +9,9 @@ import {TabPaneName, TabsPaneContext} from "element-plus"; import YysRank from "@/components/YysRank.vue"; const filesStore = useFilesStore(); +const NEW_PROJECT_URL = 'https://fireschain.org/onmyoji-flow/'; +const REDIRECT_PROMPT_SESSION_KEY = 'yys-editor.new-project-redirect-prompted'; +const REDIRECT_PROMPT_DISABLED_KEY = 'yys-editor.new-project-redirect-disabled'; const yysRef = ref(null); const width = ref('100%'); @@ -16,6 +19,37 @@ const height = ref('100vh'); const toolbarHeight = 48; // 工具栏的高度 const windowHeight = ref(window.innerHeight); const contentHeight = computed(() => `${windowHeight.value - toolbarHeight}px`); +const showRedirectPrompt = ref(false); +const dontShowRedirectPromptAgain = ref(false); + +const rememberRedirectPromptChoice = () => { + if (dontShowRedirectPromptAgain.value) { + window.localStorage.setItem(REDIRECT_PROMPT_DISABLED_KEY, 'true'); + } +}; + +const showNewProjectRedirectPrompt = () => { + if (window.localStorage.getItem(REDIRECT_PROMPT_DISABLED_KEY) === 'true') { + return; + } + + if (window.sessionStorage.getItem(REDIRECT_PROMPT_SESSION_KEY) === 'true') { + return; + } + + window.sessionStorage.setItem(REDIRECT_PROMPT_SESSION_KEY, 'true'); + showRedirectPrompt.value = true; +}; + +const goToNewProject = () => { + rememberRedirectPromptChoice(); + window.location.assign(NEW_PROJECT_URL); +}; + +const stayOnLegacyProject = () => { + rememberRedirectPromptChoice(); + showRedirectPrompt.value = false; +}; const onResizing = (x, y, width, height) => { width.value = width; @@ -64,6 +98,7 @@ onMounted(() => { window.addEventListener('resize', () => { windowHeight.value = window.innerHeight; }); + showNewProjectRedirectPrompt(); }); onUnmounted(() => { @@ -112,6 +147,26 @@ const activeFileGroups = computed(() => { + +

+ yys-editor 已迁移到新项目 onmyoji-flow。新版会继续维护资源与功能,是否现在前往? +

+ + 以后不再提示 + + +
@@ -157,4 +212,9 @@ const activeFileGroups = computed(() => { max-width: 100%; } - \ No newline at end of file +.redirect-prompt-text { + margin: 0 0 16px; + line-height: 1.7; + color: #303133; +} + diff --git a/src/components/Toolbar.vue b/src/components/Toolbar.vue index 6a633bf..35c2fdb 100644 --- a/src/components/Toolbar.vue +++ b/src/components/Toolbar.vue @@ -1,6 +1,9 @@