Skip to content

Commit b8fe932

Browse files
committed
feat: expand the search functionality in the GoToComicDialog
... to allow for searching for comics not only by the text in their title/tagline, but also by which items are present in the comic and whether or not the comic is a guest comic or non-canon. Closes #15
1 parent f3c6eef commit b8fe932

9 files changed

Lines changed: 717 additions & 57 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added ✨
1111

1212
- Add the ability to lock comic navigation to an item. Closes [#33](https://github.com/Questionable-Content-Extensions/client/issues/33)
13+
- Expand the search functionality in the `GoToComicDialog` to allow for searching for comics not only by the text in their title/tagline, but also by which items are present in the comic and whether or not the comic is a guest comic or non-canon. Closes [#15](https://github.com/Questionable-Content-Extensions/client/issues/15)
1314

1415
### Changed 🔧
1516

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { useState } from 'react'
2+
3+
import { Meta, StoryObj } from '@storybook/react'
4+
5+
import { ALL_ITEMS, useMswReady } from '~/mocks'
6+
7+
import ComicFilter, { Filter } from './ComicFilter'
8+
9+
export default {
10+
component: ComicFilter,
11+
} as Meta<typeof ComicFilter>
12+
13+
export const Default: StoryObj<typeof ComicFilter> = {
14+
render: (args) => {
15+
// eslint-disable-next-line react-hooks/rules-of-hooks
16+
const mswReady = useMswReady()
17+
18+
// Then, let's fake the necessary REST calls
19+
const { worker, rest } = window.msw
20+
worker.use(
21+
rest.get(
22+
'http://localhost:3000/api/v2/itemdata/',
23+
(req, res, ctx) => {
24+
const all = [...ALL_ITEMS]
25+
const name =
26+
'This is a mocked API response and will only be accurate for comic 666'
27+
all.push({
28+
id: -1,
29+
name,
30+
shortName: name,
31+
count: 0,
32+
type: 'storyline',
33+
color: 'ffaabb',
34+
})
35+
return res(ctx.json(all))
36+
}
37+
)
38+
)
39+
40+
// eslint-disable-next-line react-hooks/rules-of-hooks
41+
const [filters, setFilters] = useState<Filter[]>([])
42+
43+
return mswReady ? (
44+
<ComicFilter {...args} filters={filters} setFilters={setFilters} />
45+
) : (
46+
<></>
47+
)
48+
},
49+
}

0 commit comments

Comments
 (0)