Skip to content

Commit

Permalink
feat: 增加 gist 链接和最近一次检查状态的说明
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jan 16, 2024
1 parent f1963da commit 683d1ce
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 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.56",
"version": "2.14.57",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
8 changes: 8 additions & 0 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,14 @@ export default {
selectSource: {
title: 'Select Source',
},
preview: {
title: 'Sub-Store Gist',
content: '⚠️ The status of the latest check: {status}.\nYou can update the configuration to trigger a new check.',
url: 'The current gist is the last one that was checked successfully.',
noUrl: 'Once you have successfully checked and uploaded the synchronized configuration, you can view the gist.',
cancel: 'Cancel',
confirm: 'View Gist',
}
},
themeSettingPage: {
themeSettingTitle: 'Appearance',
Expand Down
8 changes: 8 additions & 0 deletions src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,14 @@ export default {
selectSource: {
title: '选择来源',
},
preview: {
title: 'Sub-Store Gist',
content: '最近一次检查的状态: {status}\n更新配置后将自动触发一次检查',
url: '当前的 gist 为最后一次检查正常的 gist',
noUrl: '检查成功并上传同步配置后 即可查看',
cancel: '取消',
confirm: '查看 gist',
}
},
themeSettingPage: {
themeSettingTitle: '外观设置',
Expand Down
3 changes: 3 additions & 0 deletions src/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const useSettingsStore = defineStore('settingsStore', {
},
avatarUrl: '',
artifactStore: '',
artifactStoreStatus: '',
autoDownloadGistSync: false,
// ishostApi: localStorage.getItem('hostApi'),
};
Expand All @@ -41,6 +42,7 @@ export const useSettingsStore = defineStore('settingsStore', {
this.syncTime = res.data.syncTime || 0;
this.avatarUrl = res.data.avatarUrl || '';
this.artifactStore = res.data.artifactStore || '';
this.artifactStoreStatus = res.data.artifactStoreStatus || '';

this.theme.auto = res.data.theme?.auto ?? true;
this.theme.name = res.data.theme?.name ?? 'light';
Expand Down Expand Up @@ -69,6 +71,7 @@ export const useSettingsStore = defineStore('settingsStore', {
this.defaultTimeout = res.data.defaultTimeout || '';
this.avatarUrl = res.data.avatarUrl || '';
this.artifactStore = res.data.artifactStore || '';
this.artifactStoreStatus = res.data.artifactStoreStatus || '';
showNotify({ type: 'success', title: t(`myPage.notify.save.succeed`) });
}
},
Expand Down
1 change: 1 addition & 0 deletions src/types/store/settings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ interface SettingsBase {
syncTime: number;
avatarUrl: string;
artifactStore: string;
artifactStoreStatus?: string;
// ishostApi: string;
}

Expand Down
39 changes: 35 additions & 4 deletions src/views/Sync.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
plain
size="small"
@click="preview"
v-if="artifactStoreUrl"
>
<font-awesome-icon icon="fa-solid fa-eye" />
</nut-button>
Expand Down Expand Up @@ -92,6 +91,22 @@
</template>
</draggable>
</div>
<div v-else class="subs-list-wrapper">
<div class="sticky-title-wrapper sync-title">
<p class="list-title">{{ $t(`syncPage.title`) }}</p>
<div class="actions-wrapper">
<nut-button
class="preview-btn btn"
type="info"
plain
size="small"
@click="preview"
>
<font-awesome-icon icon="fa-solid fa-eye" />
</nut-button>
</div>
</div>
</div>

<!--没有数据-->
<div
Expand Down Expand Up @@ -156,6 +171,7 @@ import { useSubsApi } from "@/api/subs";
import { useI18n } from "vue-i18n";
import { useAppNotifyStore } from "@/store/appNotify";
import { useBackend } from "@/hooks/useBackend";
import { Dialog } from '@nutui/nutui';
const { env } = useBackend();
const subsApi = useSubsApi();
Expand All @@ -165,7 +181,7 @@ const artifactsStore = useArtifactsStore();
const settingsStore = useSettingsStore();
const { isLoading, fetchResult, bottomSafeArea, showFloatingRefreshButton } = storeToRefs(globalStore);
const { artifacts } = storeToRefs(artifactsStore);
const { artifactStore: artifactStoreUrl } = storeToRefs(settingsStore);
const { artifactStore: artifactStoreUrl, artifactStoreStatus } = storeToRefs(settingsStore);
const { showNotify } = useAppNotifyStore();
const swipeDisabled = ref(false);
const isEditPanelVisible = ref(false);
Expand Down Expand Up @@ -212,8 +228,23 @@ const refresh = () => {
};
const preview = () => {
// console.log(artifactStoreUrl.value);
window.open(artifactStoreUrl.value);
if (artifactStoreUrl.value && (!artifactStoreStatus.value ||artifactStoreStatus.value === "VALID")) {
window.open(artifactStoreUrl.value);
} else {
Dialog({
popClass: 'auto-dialog',
title: t(`syncPage.preview.title`),
content: artifactStoreUrl.value ? `${t('syncPage.preview.content', { status: artifactStoreStatus.value || 'VALID' })}\n${t('syncPage.preview.url')}` : `${t('syncPage.preview.content', { status: artifactStoreStatus.value || '-' })}\n${t('syncPage.preview.noUrl')}`,
noOkBtn: !artifactStoreUrl.value,
okText: t(`syncPage.preview.confirm`),
cancelText: t(`syncPage.preview.cancel`),
// @ts-ignore
closeOnClickOverlay: true,
onOk: () => {
window.open(artifactStoreUrl.value);
},
});
}
};
const onClickEdit = (artifact: Artifact) => {
Expand Down

0 comments on commit 683d1ce

Please sign in to comment.