feat: guest auth (#141)

* feat: Start using guest auth

* feat: Implement more functionality to work as guest

* chore: update package and tweak public route

* chore: update root package json

* chore: update web package json

---------

Co-authored-by: Aslam H <iupin5212@gmail.com>
This commit is contained in:
Anselm Eickhoff
2024-09-06 21:11:43 +01:00
committed by GitHub
parent e61aae02d5
commit 844b1ae334
16 changed files with 138 additions and 205 deletions

View File

@@ -13,7 +13,7 @@ interface GraphNode {
interface AutocompleteProps {
topics: GraphNode[]
onSelect: (topic: GraphNode) => void
onSelect: (topic: string) => void
onInputChange: (value: string) => void
}
@@ -46,18 +46,16 @@ export function Autocomplete({ topics = [], onSelect, onInputChange }: Autocompl
const handleSelect = useCallback(
(topic: GraphNode) => {
setInputValue(topic.prettyName)
// setInputValue(topicPrettyName)
setOpen(false)
onSelect(topic)
onSelect(topic.name)
},
[onSelect]
)
const handleKeyDown = useCallback(
(e: React.KeyboardEvent<HTMLDivElement>) => {
if (e.key === "Enter" && filteredTopics.length > 0) {
handleSelect(filteredTopics[0])
} else if ((e.key === "Backspace" || e.key === "Delete") && inputRef.current?.value === "") {
if ((e.key === "Backspace" || e.key === "Delete") && inputRef.current?.value === "") {
setOpen(true)
setIsInitialOpen(true)
}
@@ -65,7 +63,7 @@ export function Autocomplete({ topics = [], onSelect, onInputChange }: Autocompl
setHasInteracted(true)
}
},
[filteredTopics, handleSelect, hasInteracted]
[hasInteracted]
)
const handleInputChange = useCallback(
@@ -143,6 +141,7 @@ export function Autocomplete({ topics = [], onSelect, onInputChange }: Autocompl
{filteredTopics.map((topic, index) => (
<CommandItem
key={index}
value={topic.name}
onSelect={() => handleSelect(topic)}
className="min-h-10 rounded-none px-3 py-1.5"
>