feeds-fun 1.22.8 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/css/inputs.css +14 -0
- package/src/logic/enums.ts +8 -4
- package/src/logic/settings.ts +23 -0
- package/src/views/MainView.vue +27 -1
package/package.json
CHANGED
package/src/css/inputs.css
CHANGED
|
@@ -29,6 +29,20 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
.ffun-main-button {
|
|
33
|
+
@apply ffun-x-input-common border-0;
|
|
34
|
+
@apply text-xl;
|
|
35
|
+
@apply px-3 py-2;
|
|
36
|
+
@apply rounded-lg shadow-sm border focus:ring-0;
|
|
37
|
+
|
|
38
|
+
@apply text-blue-700;
|
|
39
|
+
@apply border-blue-300 hover:border-blue-400;
|
|
40
|
+
|
|
41
|
+
&.short {
|
|
42
|
+
@apply p-1 px-2;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
.ffun-form-button {
|
|
33
47
|
@apply ffun-x-input-common font-semibold text-white;
|
|
34
48
|
@apply px-4 py-2;
|
package/src/logic/enums.ts
CHANGED
|
@@ -57,7 +57,7 @@ export enum LastEntriesPeriod {
|
|
|
57
57
|
Day3 = "day3",
|
|
58
58
|
Week = "week",
|
|
59
59
|
Week2 = "week2",
|
|
60
|
-
Month1 = "
|
|
60
|
+
Month1 = "month1",
|
|
61
61
|
Month3 = "month3",
|
|
62
62
|
Month6 = "month6",
|
|
63
63
|
Year1 = "year1",
|
|
@@ -70,8 +70,7 @@ export type LastEntriesPeriodProperty = {
|
|
|
70
70
|
readonly default?: boolean;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
export const LastEntriesPeriodProperties = new Map<LastEntriesPeriod, LastEntriesPeriodProperty>([
|
|
73
|
+
const lastEntriesPeriodEntries: ReadonlyArray<readonly [LastEntriesPeriod, LastEntriesPeriodProperty]> = [
|
|
75
74
|
[LastEntriesPeriod.Hour1, {text: "1 hour", seconds: c.hour}],
|
|
76
75
|
[LastEntriesPeriod.Hour3, {text: "3 hours", seconds: 3 * c.hour}],
|
|
77
76
|
[LastEntriesPeriod.Hour6, {text: "6 hours", seconds: 6 * c.hour}],
|
|
@@ -85,7 +84,12 @@ export const LastEntriesPeriodProperties = new Map<LastEntriesPeriod, LastEntrie
|
|
|
85
84
|
[LastEntriesPeriod.Month6, {text: "6 months", seconds: 6 * c.month}],
|
|
86
85
|
[LastEntriesPeriod.Year1, {text: "1 year", seconds: c.year}],
|
|
87
86
|
[LastEntriesPeriod.AllTime, {text: "all time", seconds: c.infinity}]
|
|
88
|
-
]
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
// Map preserves the order of the keys
|
|
90
|
+
export const LastEntriesPeriodProperties = new Map<LastEntriesPeriod, LastEntriesPeriodProperty>(
|
|
91
|
+
lastEntriesPeriodEntries.filter(([key]) => settings.entriesPeriodList.includes(key))
|
|
92
|
+
);
|
|
89
93
|
|
|
90
94
|
////////////////
|
|
91
95
|
// Entries order
|
package/src/logic/settings.ts
CHANGED
|
@@ -24,6 +24,29 @@ export const crmImpressum = import.meta.env.VITE_FFUN_CRM_IMPRESSUM || null;
|
|
|
24
24
|
|
|
25
25
|
export const hasCollections = import.meta.env.VITE_FFUN_HAS_COLLECTIONS == "true" || false;
|
|
26
26
|
|
|
27
|
+
function jsonOrDefault<T>(value: string | undefined, defaultValue: T): T {
|
|
28
|
+
if (!value) return defaultValue;
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
return JSON.parse(value);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.warn("Failed to parse JSON value, using default", {value, error: e});
|
|
34
|
+
return defaultValue;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const entriesPeriodList = jsonOrDefault(import.meta.env.VITE_FFUN_ENTRIES_PERIOD_LIST, [
|
|
39
|
+
"hour1",
|
|
40
|
+
"hour3",
|
|
41
|
+
"hour6",
|
|
42
|
+
"hour12",
|
|
43
|
+
"day1",
|
|
44
|
+
"day3",
|
|
45
|
+
"week",
|
|
46
|
+
"week2",
|
|
47
|
+
"month1"
|
|
48
|
+
]);
|
|
49
|
+
|
|
27
50
|
console.log("settings.version", version);
|
|
28
51
|
|
|
29
52
|
console.log("settings.authRefreshInterval", authRefreshInterval);
|
package/src/views/MainView.vue
CHANGED
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
<main-block v-if="settings.hasCollections">
|
|
201
201
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
202
202
|
<template
|
|
203
|
-
v-for="collectionId in
|
|
203
|
+
v-for="collectionId in collectionsToShow"
|
|
204
204
|
:key="collectionId">
|
|
205
205
|
<main-item v-if="collections.collections[collectionId].showOnMain">
|
|
206
206
|
<template #caption>
|
|
@@ -220,6 +220,16 @@
|
|
|
220
220
|
</main-item>
|
|
221
221
|
</template>
|
|
222
222
|
</div>
|
|
223
|
+
|
|
224
|
+
<div
|
|
225
|
+
v-if="showMoreCollectionsButtonRequired"
|
|
226
|
+
class="mt-4 text-center">
|
|
227
|
+
<button
|
|
228
|
+
class="ffun-main-button short"
|
|
229
|
+
@click="showAllCollections = !showAllCollections">
|
|
230
|
+
{{ showAllCollections ? "Show less" : "Show more" }}
|
|
231
|
+
</button>
|
|
232
|
+
</div>
|
|
223
233
|
</main-block>
|
|
224
234
|
|
|
225
235
|
<main-header-line> Here, take a peek </main-header-line>
|
|
@@ -252,6 +262,22 @@
|
|
|
252
262
|
|
|
253
263
|
provide("eventsViewName", eventsView);
|
|
254
264
|
|
|
265
|
+
const showAllCollections = ref(false);
|
|
266
|
+
|
|
267
|
+
const alwaysVisibleCollectionsCount = 4;
|
|
268
|
+
|
|
269
|
+
const collectionsToShow = computed(() => {
|
|
270
|
+
if (showAllCollections.value) {
|
|
271
|
+
return collections.collectionsOrder;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return collections.collectionsOrder.slice(0, alwaysVisibleCollectionsCount + 1);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const showMoreCollectionsButtonRequired = computed(() => {
|
|
278
|
+
return collections.collectionsOrder.length > alwaysVisibleCollectionsCount;
|
|
279
|
+
});
|
|
280
|
+
|
|
255
281
|
function publicCollectionHref(collectionSlug: t.CollectionSlug) {
|
|
256
282
|
return router.resolve({name: "public-collection", params: {collectionSlug: collectionSlug}}).href;
|
|
257
283
|
}
|