New Feature: Watch Listings (#215)

* adding new feature: watch listings for changes

* adding todo for watch feature

* sort by watch
This commit is contained in:
Christian Kellner
2025-10-05 14:23:32 +02:00
committed by GitHub
parent 9f1e27d011
commit a5efd9af32
14 changed files with 383 additions and 70 deletions

View File

@@ -132,14 +132,22 @@ export const useFredyState = create(
},
},
listingsTable: {
async getListingsTable({ page = 1, pageSize = 20, filter = null, sortfield = null, sortdir = 'asc' }) {
async getListingsTable({
page = 1,
pageSize = 20,
freeTextFilter = null,
sortfield = null,
sortdir = 'asc',
filter,
}) {
try {
const qryString = queryString.stringify({
page,
pageSize,
filter,
freeTextFilter,
sortfield,
sortdir,
...filter,
});
const response = await xhrGet(`/api/listings/table?${qryString}`);
set((state) => ({

View File

@@ -1,11 +1,12 @@
export function format(ts) {
export function format(ts, showSeconds = true) {
return new Intl.DateTimeFormat('default', {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
...(showSeconds ? { second: 'numeric' } : {}),
}).format(ts);
}
export const roundToHour = (ts) => Math.ceil(ts / (1000 * 60 * 60)) * (1000 * 60 * 60);