Skip to content

Commit

Permalink
feat: 启用新的默认图标, 可在设置中恢复(感谢 @ccc63)
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jan 19, 2024
1 parent 7dba76b commit 1c9716c
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
"version": "2.14.78",
"version": "2.14.79",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
Binary file added src/assets/icons/logo-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/logo-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 13 additions & 9 deletions src/assets/icons/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions src/components/ArtifactsListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
</template>

<script lang="ts" setup>
import logoIcon from '@/assets/icons/logo.svg';
import logoIcon from '@/assets/icons/logo.png';
import logoRedIcon from '@/assets/icons/logo-red.png';
import singboxIcon from '@/assets/icons/sing-box.png';
import clashIcon from '@/assets/icons/clash.png';
import clashMetaIcon from '@/assets/icons/clashmeta.png';
Expand Down Expand Up @@ -124,7 +125,7 @@ import { useGlobalStore } from '@/store/global';
import { useHostAPI } from '@/hooks/useHostAPI';
const globalStore = useGlobalStore();
const { isLeftRight, isSimpleMode, isIconColor } = storeToRefs(globalStore);
const { isLeftRight, isSimpleMode, isIconColor, isDefaultIcon } = storeToRefs(globalStore);
const { copy, isSupported } = useClipboard();
const { toClipboard: copyFallback } = useV3Clipboard();
Expand Down Expand Up @@ -210,7 +211,7 @@ const icon = computed(() => {
case 'Surfboard':
return isIconColor.value ? surfboardColorIcon: surfboardIcon;
default:
return logoIcon;
return isDefaultIcon.value ? logoIcon : logoRedIcon;
}
});
Expand Down
7 changes: 6 additions & 1 deletion src/components/FileListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
<script lang="ts" setup>
import { useSubsApi } from '@/api/subs';
import { useFilesApi } from '@/api/files';
import icon from '@/assets/icons/logo.svg';
import logoIcon from '@/assets/icons/logo.png';
import logoRedIcon from '@/assets/icons/logo-red.png';
import { usePopupRoute } from '@/hooks/usePopupRoute';
import { useAppNotifyStore } from '@/store/appNotify';
import { useGlobalStore } from '@/store/global';
Expand Down Expand Up @@ -220,13 +221,17 @@
isLeftRight,
isIconColor,
isSimpleReicon,
isDefaultIcon
} = storeToRefs(globalStore);
const displayName =
props[props.type].displayName || props[props.type]['display-name'];
const name = props[props.type].name;
const { flows } = storeToRefs(subsStore);
const icon = computed(() => {
return isDefaultIcon.value ? logoIcon : logoRedIcon;
})
const collectionDetail = computed(() => {
const nameList = props?.collection.subscriptions || [];
if (nameList.length === 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/PreviewPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import v2ray from '@/assets/icons/v2ray.png';
import singbox from '@/assets/icons/sing-box.png';
import clashmeta from '@/assets/icons/clashmeta.png';
import logoicon from '@/assets/icons/logo.svg';
import logoIcon from '@/assets/icons/logo.png';
import { useClipboard } from '@vueuse/core';
import useV3Clipboard from 'vue-clipboard3';
import { useAppNotifyStore } from '@/store/appNotify';
Expand Down Expand Up @@ -89,7 +89,7 @@
{
name: general,
path: null,
icon: logoicon,
icon: logoIcon,
},
{
name: 'Stash',
Expand Down
7 changes: 6 additions & 1 deletion src/components/SubListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@

<script lang="ts" setup>
import { useSubsApi } from '@/api/subs';
import icon from '@/assets/icons/logo.svg';
import logoIcon from '@/assets/icons/logo.png';
import logoRedIcon from '@/assets/icons/logo-red.png';
import PreviewPanel from '@/components/PreviewPanel.vue';
import { usePopupRoute } from '@/hooks/usePopupRoute';
import { useAppNotifyStore } from '@/store/appNotify';
Expand Down Expand Up @@ -244,13 +245,17 @@
isLeftRight,
isIconColor,
isSimpleReicon,
isDefaultIcon,
} = storeToRefs(globalStore);
const displayName =
props[props.type].displayName || props[props.type]['display-name'];
const name = props[props.type].name;
const { flows } = storeToRefs(subsStore);
const icon = computed(() => {
return isDefaultIcon.value ? logoIcon : logoRedIcon;
})
const collectionDetail = computed(() => {
const nameList = props?.collection.subscriptions || [];
if (nameList.length === 0) {
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ export default {
simple: 'Simple Mode',
islr: 'Card right swipe to call out',
isIC: 'Use original color for custom icons',
isDefaultIcon: 'Restore default icon',
isEditorCommon: 'Show editor common settings',
isSimpleReicon: 'Show items refresh button',
showFloatingRefreshButton: 'Show floating refresh button',
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ export default {
simple: '简洁模式',
islr: '卡片右滑呼出',
isIC: '自定义图标使用原始颜色',
isDefaultIcon: '恢复默认图标',
isEditorCommon: '展示编辑页常用配置',
isSimpleReicon: '展示订阅刷新按钮',
showFloatingRefreshButton: '显示悬浮刷新按钮',
Expand Down
9 changes: 9 additions & 0 deletions src/store/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const useGlobalStore = defineStore('globalStore', {
isFlowFetching: true,
fetchResult: false,
bottomSafeArea: 0,
isDefaultIcon: false,
isDarkMode: false,
env: {},
isSimpleMode: localStorage.getItem('isSimpleMode') === '1',
Expand Down Expand Up @@ -68,6 +69,14 @@ export const useGlobalStore = defineStore('globalStore', {
}
this.isIconColor = iconColor;
},
setIsDefaultIcon(isDefaultIcon: boolean) {
if (isDefaultIcon) {
localStorage.setItem('isDefaultIcon', '1');
} else {
localStorage.removeItem('isDefaultIcon');
}
this.isDefaultIcon = isDefaultIcon;
},
setEditorCommon(isEditorCommon: boolean) {
if (!isEditorCommon) {
localStorage.setItem('iseditorCommon', '1');
Expand Down
1 change: 1 addition & 0 deletions src/types/store/globalStore.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
interface GlobalStoreState {
isLoading: boolean;
isDefaultIcon: boolean;
isFlowFetching: boolean;
fetchResult: boolean;
bottomSafeArea: number;
Expand Down
11 changes: 6 additions & 5 deletions src/views/SubEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@
>
<div class="sub-img-wrapper">
<nut-avatar
class="sub-item-customer-icon"
:class="{ 'sub-item-customer-icon': !isIconColor }"
v-if="item[2]"
size="32"
:url="item[2]"
bg-color=""
></nut-avatar>
<span>{{ item[1] }}</span>
<span>&nbsp;{{ item[1] }}</span>
</div>
</nut-checkbox>
</nut-checkboxgroup>
Expand Down Expand Up @@ -235,7 +235,8 @@
<script lang="ts" setup>
import { useArtifactsStore } from "@/store/artifacts";
import { useSubsApi } from '@/api/subs';
import icon from '@/assets/icons/logo.svg';
import logoIcon from '@/assets/icons/logo.png';
import logoRedIcon from '@/assets/icons/logo-red.png';
import { usePopupRoute } from '@/hooks/usePopupRoute';
import { useAppNotifyStore } from '@/store/appNotify';
import { useGlobalStore } from '@/store/global';
Expand Down Expand Up @@ -275,7 +276,7 @@
const { showNotify } = useAppNotifyStore();
const globalStore = useGlobalStore();
const { bottomSafeArea, isEditorCommon } = storeToRefs(globalStore);
const { bottomSafeArea, isEditorCommon, isDefaultIcon, isIconColor } = storeToRefs(globalStore);
const padding = bottomSafeArea.value + 'px';
const sub = computed(() => subsStore.getOneSub(configName));
Expand All @@ -286,7 +287,7 @@
return [
item.name,
item.displayName || item['display-name'] || item.name,
item.icon || icon,
item.icon || (isDefaultIcon.value ? logoIcon : logoRedIcon),
];
});
});
Expand Down
16 changes: 16 additions & 0 deletions src/views/settings/moreSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
</template>
</nut-cell>

<nut-cell :title="$t(`moreSettingPage.isDefaultIcon`)" class="cell-item">
<template v-slot:link>
<nut-switch
class="my-switch"
v-model="awIsDefaultIcon"
size="mini"
@change="setIsDefaultIcon"
/>
</template>
</nut-cell>
<nut-cell :title="$t(`moreSettingPage.isIC`)" class="cell-item">
<template v-slot:link>
<nut-switch
Expand Down Expand Up @@ -186,6 +196,7 @@
isLeftRight,
ishostApi,
isIconColor,
isDefaultIcon,
isEditorCommon,
isSimpleReicon,
showFloatingRefreshButton,
Expand All @@ -198,6 +209,7 @@
const SimpleSwitch = ref(false);
const LeftRight = ref(false);
const awIconColor = ref(false);
const awIsDefaultIcon = ref(false);
const awEditorCommon = ref(false);
const awSimpleReicon = ref(true);
const awShowFloatingRefreshButton = ref(false);
Expand All @@ -222,6 +234,9 @@
const setIconColor = (isIconColor: boolean) => {
globalStore.setIconColor(isIconColor);
};
const setIsDefaultIcon = (isDefaultIcon: boolean) => {
globalStore.setIsDefaultIcon(isDefaultIcon);
};
const setEditorCommon = (isIconColor: boolean) => {
globalStore.setEditorCommon(isIconColor);
Expand Down Expand Up @@ -365,6 +380,7 @@
LeftRight.value = isLeftRight.value;
autoSwitchSync.value = autoDownloadGistSync.value;
awIconColor.value = isIconColor.value;
awIsDefaultIcon.value = isDefaultIcon.value;
awEditorCommon.value = isEditorCommon.value;
awEditorCommon.value = isEditorCommon.value;
awSimpleReicon.value = isSimpleReicon.value;
Expand Down

0 comments on commit 1c9716c

Please sign in to comment.