Skip to content

Commit

Permalink
fix lint, resolve code smell
Browse files Browse the repository at this point in the history
Co-Authored-By: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
  • Loading branch information
syuilo and u1-liquid committed Nov 22, 2023
1 parent c284d41 commit b15f293
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/server/api/endpoints/admin/ad/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const paramDef = {
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
sinceId: { type: 'string', format: 'misskey:id' },
untilId: { type: 'string', format: 'misskey:id' },
publishing: { type: 'boolean', default: null, nullable: true},
publishing: { type: 'boolean', default: null, nullable: true },
},
required: [],
} as const;
Expand Down
22 changes: 14 additions & 8 deletions packages/frontend/src/pages/admin/ads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<XHeader :actions="headerActions" :tabs="headerTabs"/>
</template>
<MkSpacer :contentMax="900">
<MkSelect v-model="type" :class="$style.input" @update:modelValue="onChangePublishing">
<MkSelect v-model="filterType" :class="$style.input" @update:modelValue="filterItems">
<template #label>{{ i18n.ts.state }}</template>
<option value="null">{{ i18n.ts.all }}</option>
<option value="true">{{ i18n.ts.publishing }}</option>
<option value="false">{{ i18n.ts.expired }}</option>
<option value="all">{{ i18n.ts.all }}</option>
<option value="publishing">{{ i18n.ts.publishing }}</option>
<option value="expired">{{ i18n.ts.expired }}</option>
</MkSelect>
<div>
<div v-for="ad in ads" class="_panel _gaps_m" :class="$style.ad">
Expand Down Expand Up @@ -104,8 +104,8 @@ let ads: any[] = $ref([]);
const localTime = new Date();
const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000;
const daysOfWeek: string[] = [i18n.ts._weekday.sunday, i18n.ts._weekday.monday, i18n.ts._weekday.tuesday, i18n.ts._weekday.wednesday, i18n.ts._weekday.thursday, i18n.ts._weekday.friday, i18n.ts._weekday.saturday];
const filterType = ref('all');
let publishing: boolean | null = null;
let type = ref('null');
os.api('admin/ad/list', { publishing: publishing }).then(adsResponse => {
if (adsResponse != null) {
Expand All @@ -123,9 +123,15 @@ os.api('admin/ad/list', { publishing: publishing }).then(adsResponse => {
}
});
const onChangePublishing = (v) => {
console.log(v);
publishing = v === 'true' ? true : v === 'false' ? false : null;
const filterItems = (v) => {
if (v === 'publishing') {
publishing = true;
} else if (v === 'expired') {
publishing = false;
} else {
publishing = null;
}
refresh();
};
Expand Down

0 comments on commit b15f293

Please sign in to comment.