Skip to content

Commit

Permalink
移除远古无用 notification 封装
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanxven committed Jan 17, 2025
1 parent af82a82 commit 02a7f42
Show file tree
Hide file tree
Showing 16 changed files with 241 additions and 287 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "league-akari",
"version": "1.3.3-rabi.6",
"version": "1.3.3-rabi.7",
"author": {
"name": "Hanxven",
"email": "[email protected]"
Expand Down Expand Up @@ -43,11 +43,11 @@
"@electron-toolkit/tsconfig": "^1.0.1",
"@electron/notarize": "^2.5.0",
"@modyfi/vite-plugin-yaml": "^1.1.0",
"@swc/core": "^1.10.6",
"@swc/core": "^1.10.7",
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
"@types/lodash": "^4.17.14",
"@types/markdown-it": "^14.1.2",
"@types/node": "^22.10.5",
"@types/node": "^22.10.7",
"@types/node-7z": "^2.1.10",
"@types/semver": "^7.5.8",
"@types/ws": "^8.5.13",
Expand All @@ -58,8 +58,8 @@
"@vicons/material": "^0.13.0",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"@vueuse/components": "^12.3.0",
"@vueuse/core": "^12.3.0",
"@vueuse/components": "^12.4.0",
"@vueuse/core": "^12.4.0",
"electron": "33.3.1",
"electron-builder": "25.1.8",
"electron-vite": "^2.3.0",
Expand Down
51 changes: 0 additions & 51 deletions src/renderer-shared/notification/index.ts

This file was deleted.

20 changes: 1 addition & 19 deletions src/renderer/src-main-window/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { useAppCommonStore } from '@renderer-shared/shards/app-common/store'
import { SelfUpdateRenderer } from '@renderer-shared/shards/self-update'
import { useSelfUpdateStore } from '@renderer-shared/shards/self-update/store'
import { greeting } from '@renderer-shared/utils/greeting'
import { KYOKO_MODE_KEY_SEQUENCE, LEAGUE_AKARI_GITHUB } from '@shared/constants/common'
import { LEAGUE_AKARI_GITHUB } from '@shared/constants/common'
import { useTranslation } from 'i18next-vue'
import { useMessage, useNotification } from 'naive-ui'
import { provide, ref, watchEffect } from 'vue'
Expand Down Expand Up @@ -169,24 +169,6 @@ app.onSecondInstance(() => {
})
})
useKeyboardCombo(KYOKO_MODE_KEY_SEQUENCE, {
onFinish: () => {
if (as.settings.isInKyokoMode) {
return
}
app.setInKyokoMode(true)
notification.success({
title: 'League Akari 测试模式',
content: 'Kyoko Mode, on!',
duration: 6000
})
},
requireSameEl: true,
caseSensitive: false,
maxInterval: 500
})
const message = useMessage()
useKeyboardCombo('AKARI', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@
<span class="text">{{ t('DebugSettings.inAdministrator.description') }}</span>
</NCard>
<NCard size="small" style="margin-top: 8px">
<template #header><span class="card-header-title">Akari~</span></template>
<template #header><span class="card-header-title">Akari Zone</span></template>
<ControlItem
class="control-item-margin"
label="Kyoko Mode"
:label="t('DebugSettings.kyokoMode.title')"
:label-description="t('DebugSettings.kyokoMode.description')"
:label-width="320"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
</template>

<script setup lang="ts">
import { laNotification } from '@renderer-shared/notification'
import { useInstance } from '@renderer-shared/shards'
import { LeagueClientRenderer } from '@renderer-shared/shards/league-client'
import { useLeagueClientStore } from '@renderer-shared/shards/league-client/store'
Expand All @@ -43,7 +42,7 @@ import { useSgpStore } from '@renderer-shared/shards/sgp/store'
import { Game } from '@shared/types/league-client/match-history'
import { AxiosError } from 'axios'
import { useTranslation } from 'i18next-vue'
import { NButton, NModal } from 'naive-ui'
import { NButton, NModal, useNotification } from 'naive-ui'
import { computed, ref, shallowRef, watch } from 'vue'
import { MatchHistoryTabsRenderer } from '@main-window/shards/match-history-tabs'
Expand All @@ -65,6 +64,8 @@ const mh = useInstance<MatchHistoryTabsRenderer>('match-history-tabs-renderer')
const sgps = useSgpStore()
const lcs = useLeagueClientStore()
const notification = useNotification()
// 和战绩页面的设置共享
const mhs = useMatchHistoryTabsStore()
Expand Down Expand Up @@ -110,7 +111,16 @@ const fetchGame = async (gameId: number, useSgpApi = false) => {
isNotFound.value = true
}
laNotification.warn('战绩卡片', `对局 ${props.gameId} 加载失败`, error)
notification.warning({
title: () =>
t('StandaloneMatchHistoryCardModal.errorNotification.title', {
gameId: props.gameId
}),
content: () =>
t('StandaloneMatchHistoryCardModal.errorNotification.description', {
reason: (error as Error).message
})
})
} finally {
isLoading.value = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,22 @@

<script setup lang="ts">
import LcuImage from '@renderer-shared/components/LcuImage.vue'
import { laNotification } from '@renderer-shared/notification'
import { useInstance } from '@renderer-shared/shards'
import { LeagueClientRenderer } from '@renderer-shared/shards/league-client'
import { useLeagueClientStore } from '@renderer-shared/shards/league-client/store'
import { championIconUri } from '@renderer-shared/shards/league-client/utils'
import { isBenchEnabledSession } from '@shared/types/league-client/champ-select'
import { useTranslation } from 'i18next-vue'
import { NButton, NCard, NDivider } from 'naive-ui'
import { NButton, NCard, NDivider, useNotification } from 'naive-ui'
import { computed, ref } from 'vue'
const { t } = useTranslation()
const lcs = useLeagueClientStore()
const lc = useInstance<LeagueClientRenderer>('league-client-renderer')
const notification = useNotification()
const benchChampions = computed(() => {
if (!isBenchEnabledSession(lcs.champSelect.session)) {
return null
Expand Down Expand Up @@ -118,11 +119,10 @@ const handleBenchSwap = async (championId: number) => {
try {
await lc.api.champSelect.benchSwap(championId)
} catch (error) {
laNotification.warn(
t('ChampionBench.swapFailedNotification.title'),
t('ChampionBench.swapFailedNotification.description'),
error
)
notification.warning({
title: () => t('ChampionBench.swapFailedNotification.title'),
content: () => t('ChampionBench.swapFailedNotification.description')
})
} finally {
isSwapping.value = false
}
Expand All @@ -148,11 +148,10 @@ const handleReroll = async (grabBack = false) => {
}, 25)
}
} catch (error) {
laNotification.warn(
t('ChampionBench.rerollFailedNotification.title'),
t('ChampionBench.rerollFailedNotification.description'),
error
)
notification.warning({
title: () => t('ChampionBench.rerollFailedNotification.title'),
content: () => t('ChampionBench.rerollFailedNotification.description')
})
} finally {
isRerolling.value = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@

<script setup lang="ts">
import ControlItem from '@renderer-shared/components/ControlItem.vue'
import { laNotification } from '@renderer-shared/notification'
import { useInstance } from '@renderer-shared/shards'
import { useAppCommonStore } from '@renderer-shared/shards/app-common/store'
import { LeagueClientRenderer } from '@renderer-shared/shards/league-client'
import { useLeagueClientStore } from '@renderer-shared/shards/league-client/store'
import { useTranslation } from 'i18next-vue'
import { NButton, NCard } from 'naive-ui'
import { NButton, NCard, useNotification } from 'naive-ui'
import { computed } from 'vue'
const { t } = useTranslation()
Expand All @@ -63,17 +62,19 @@ const as = useAppCommonStore()
const lcs = useLeagueClientStore()
const lc = useInstance<LeagueClientRenderer>('league-client-renderer')
const notification = useNotification()
const handleDodge = async () => {
try {
await lc.api.login.dodge()
} catch (error) {
laNotification.warn(
t('GameflowInProgress.dodge.failedNotification.title'),
t('GameflowInProgress.dodge.failedNotification.description', {
reason: (error as Error).message
}),
error
)
notification.warning({
title: () => t('GameflowInProgress.dodge.failedNotification.title'),
content: () =>
t('GameflowInProgress.dodge.failedNotification.description', {
reason: (error as Error).message
})
})
}
}
Expand All @@ -89,13 +90,13 @@ const handlePlayAgain = async () => {
try {
await lc.api.lobby.playAgain()
} catch (error) {
laNotification.warn(
t('GameflowInProgress.playAgain.failedNotification.title'),
t('GameflowInProgress.playAgain.failedNotification.description', {
reason: (error as Error).message
}),
error
)
notification.warning({
title: () => t('GameflowInProgress.playAgain.failedNotification.title'),
content: () =>
t('GameflowInProgress.playAgain.failedNotification.description', {
reason: (error as Error).message
})
})
}
}
</script>
Expand Down
Loading

0 comments on commit 02a7f42

Please sign in to comment.