Fixed filter schemas

This commit is contained in:
WardPearce
2026-03-05 01:23:43 +13:00
parent c54df1f0f0
commit 0e687d185f
3 changed files with 25 additions and 20 deletions
@@ -45,7 +45,7 @@
{#if $filterContentListStore}
{#each $filterContentListStore as filter, index (index)}
<article class="no-margin">
<article class="no-margin surface-container-highest">
<h6>{filter.type}</h6>
<ul class="list">
{#each filter.conditions as condition, index (index)}
@@ -67,3 +67,8 @@
<div class="small-space"></div>
{/each}
{/if}
<button class="surface-container-highest">
<i>add</i>
<span>Add filter</span>
</button>
+4 -2
View File
@@ -52,7 +52,7 @@ export function isItemFiltered(item: FeedItem): boolean {
const filteredContent = get(filterContentListStore);
if (!filteredContent) return false;
return filteredContent.every((filterGroup) => {
return filteredContent.some((filterGroup) => {
if (filterGroup.type !== item.type) {
if (filterGroup.type !== 'video' || (item.type !== 'shortVideo' && item.type !== 'stream')) {
return false;
@@ -75,7 +75,7 @@ export function isItemFiltered(item: FeedItem): boolean {
return (
typeof fieldValue === 'string' &&
typeof condition.value === 'string' &&
fieldValue.includes(condition.value)
fieldValue.toLowerCase().includes(condition.value.toLowerCase())
);
case 'gt':
@@ -129,5 +129,7 @@ export async function loadContentFilterFromURL(url: string) {
if (!parsedFilterList.success) throw new Error(parsedFilterList.error.message);
console.log(parsedFilterList.data.filterBy);
filterContentListStore.set(parsedFilterList.data.filterBy);
}
+15 -17
View File
@@ -1,28 +1,26 @@
// Not possible to exact from typescript interfaces at runtime.
export const VideoSchema: Record<string, string> = {
videoId: 'string',
title: 'string',
description: 'string',
thumbnailUrl: 'string',
duration: 'number',
publishedAt: 'string',
author: 'string',
authorId: 'string',
authorUrl: 'string',
authauthorVerified: 'string',
published: 'number',
publishedText: 'string',
title: 'string',
type: 'string',
videoId: 'string',
viewCount: 'number',
viewCountText: 'string',
likeCount: 'number',
dislikeCount: 'number',
commentCount: 'number',
isLive: 'boolean',
type: 'string'
viewCountText: 'string'
};
export const ChannelSchema: Record<string, string> = {
author: 'string',
authorId: 'string',
name: 'string',
authorUrl: 'string',
authorVerified: 'boolean',
autoGenerated: 'boolean',
channelHandle: 'string',
description: 'string',
avatarUrl: 'string',
bannerUrl: 'string',
subscriberCount: 'number',
verified: 'boolean'
subCount: 'number'
};