Skip to content

Commit

Permalink
Advanced search fix
Browse files Browse the repository at this point in the history
  • Loading branch information
moysa committed Oct 14, 2024
1 parent 80352c6 commit c75f425
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/pages/AdvancedSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ const scopes: Record<string, () => string> = {
};

const kinds: Record<string, () => string> = {
'Notes': () => '',
'Notes': () => 'kind:1',
'Reads': () => 'kind:30023',
'Note Replies': () => 'kind:1 filter:replies',
'Reads Comments': () => 'kind:30023 filter:replies',
'Note Replies': () => 'kind:1 repliestokind:1',
'Reads Comments': () => 'kind:1 repliestokind:30023',
'Images': () => 'filter:image',
'Video': () => 'filter:video',
'Audio': () => 'filter:audio',
Expand All @@ -158,10 +158,10 @@ const orientations = ['Any', 'Vertical', 'Horizontal'];

const sortings: Record<string, () => string> = {
'Time': () => '',
'Content Score': () => 'orderby:contentscore',
'Number of Replies': () => 'orderby:numberofreplies',
'Content Score': () => 'orderby:score',
'Number of Replies': () => 'orderby:replies',
'Sats Zapped': () => 'orderby:satszapped',
'Number of Interactions': () => 'orderby:numberofinteractions',
'Number of Interactions': () => 'orderby:likes',
};

const AdvancedSearch: Component = () => {
Expand Down Expand Up @@ -216,14 +216,15 @@ const AdvancedSearch: Component = () => {
e.preventDefault();
}

createEffect(() => {
if (state.command.length === 0) {
setState('command', () => advSearch?.searchCommand || '');
return;
}
// createEffect(() => {
// console.log('ADV: ', advSearch?.searchCommand)
// if ((advSearch?.searchCommand.length || 0) > 0) {
// setState('command', () => advSearch?.searchCommand || '');
// return;
// }

advSearch?.actions.setSearchCommand(state.command);
})
// advSearch?.actions.setSearchCommand(state.command);
// })

createEffect(() => {
if (state.timeframe !== 'Custom') {
Expand Down Expand Up @@ -308,6 +309,7 @@ const AdvancedSearch: Component = () => {

const sort = `${sortings[state.sortBy]()} `;

console.log('KIND: ', kinds[state.kind]())
const kind = `${kinds[state.kind]()} `;

const orient = orientationKinds.includes(state.kind) && state.orientation !== 'Any' ?
Expand Down

0 comments on commit c75f425

Please sign in to comment.