-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify Instructions & show in main UI (#130)
* refactor: remove unused state * refactor: rename notes to instructions & hide json mode * feat: show matched notes in main UI * fix: skip knowledge display if no notes * fix: tsc issue
- Loading branch information
1 parent
8e86d33
commit 7903a73
Showing
10 changed files
with
163 additions
and
66 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
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { useAppState } from "../../state/store"; | ||
import { | ||
Alert, | ||
AlertIcon, | ||
AlertDescription, | ||
Button, | ||
Modal, | ||
ModalBody, | ||
ModalCloseButton, | ||
ModalContent, | ||
ModalHeader, | ||
ModalOverlay, | ||
useDisclosure, | ||
} from "@chakra-ui/react"; | ||
import Notes from "./Notes"; | ||
|
||
export default function MatchedNotes() { | ||
const { isOpen, onOpen, onClose } = useDisclosure(); | ||
const knowledge = useAppState((state) => state.currentTask.knowledgeInUse); | ||
const notes = knowledge?.notes; | ||
if (!notes || notes.length === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<Button variant="link" onClick={onOpen}> | ||
Found {notes.length} instructions. | ||
</Button> | ||
<Modal | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
size="xl" | ||
scrollBehavior="inside" | ||
> | ||
<ModalOverlay /> | ||
<ModalContent> | ||
<ModalHeader> | ||
WebWand uses the following instructions and tips: | ||
</ModalHeader> | ||
<ModalCloseButton /> | ||
<ModalBody> | ||
<Notes notes={notes} /> | ||
<Alert status="info" borderRadius="md" my="1rem"> | ||
<AlertIcon /> | ||
<AlertDescription fontSize="1rem"> | ||
You can customize instructions in the settings menu. | ||
</AlertDescription> | ||
</Alert> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
</> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { UnorderedList, ListItem } from "@chakra-ui/react"; | ||
|
||
export default function Notes({ notes }: { notes: string[] | undefined }) { | ||
if (!notes || notes.length === 0) { | ||
return null; | ||
} | ||
return ( | ||
<UnorderedList fontSize="0.8rem" styleType="circle"> | ||
{notes.map((note, index) => ( | ||
<ListItem key={index}>{note}</ListItem> | ||
))} | ||
</UnorderedList> | ||
); | ||
} |
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.