-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cp quest view fixup (#437) * feature(quest): Add searching to quest view and change layout * fix(build): Build UI --------- Co-authored-by: Hulto <[email protected]>
- Loading branch information
Showing
11 changed files
with
215 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Tavern - Red Team Engagement Platform</title><script defer="defer" src="/static/js/main.d09979ec.js"></script><link href="/static/css/main.48904a80.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Tavern - Red Team Engagement Platform</title><script defer="defer" src="/static/js/main.8ec47288.js"></script><link href="/static/css/main.48904a80.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> |
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../www/build/static/js/main.d09979ec.js.map → .../www/build/static/js/main.8ec47288.js.map
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
tavern/internal/www/src/components/tavern-base-ui/FreeTextSearch.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { SearchIcon } from "@chakra-ui/icons"; | ||
import { Heading, Input, InputGroup, InputLeftElement } from "@chakra-ui/react"; | ||
import React, { useEffect, useRef } from "react"; | ||
import { debounce } from "lodash" | ||
|
||
type Props = { | ||
placeholder: string; | ||
setSearch: (args: string) => void; | ||
} | ||
const FreeTextSearch = (props: Props) => { | ||
const { placeholder, setSearch } = props; | ||
|
||
const debouncedSearch = useRef( | ||
debounce(async (criteria) => { | ||
setSearch(criteria); | ||
}, 300) | ||
).current; | ||
|
||
async function handleChange(e: React.ChangeEvent<HTMLInputElement>) { | ||
debouncedSearch(e.target.value); | ||
} | ||
|
||
useEffect(() => { | ||
return () => { | ||
debouncedSearch.cancel(); | ||
}; | ||
}, [debouncedSearch]); | ||
|
||
return ( | ||
<div className="flex-1 gap-1"> | ||
<Heading size="sm" mb={2}> {placeholder}</Heading> | ||
<InputGroup className=" border-gray-300"> | ||
<InputLeftElement pointerEvents='none'> | ||
<SearchIcon color='gray.300' /> | ||
</InputLeftElement> | ||
<Input type='text' placeholder={placeholder} onChange={handleChange} /> | ||
</InputGroup> | ||
</div> | ||
); | ||
} | ||
export default FreeTextSearch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.