Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tavern/internal/www/build/asset-manifest.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tavern/internal/www/build/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions tavern/internal/www/build/static/css/main.4d2dc863.css

This file was deleted.

1 change: 0 additions & 1 deletion tavern/internal/www/build/static/css/main.4d2dc863.css.map

This file was deleted.

4 changes: 4 additions & 0 deletions tavern/internal/www/build/static/css/main.e93c0c93.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tavern/internal/www/build/static/css/main.e93c0c93.css.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useState } from 'react'
import { RadioGroup } from '@headlessui/react'
import { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Box, Heading, Input, InputGroup, InputLeftElement } from '@chakra-ui/react'
import { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Box, Heading } from '@chakra-ui/react'
import { TomeParams } from '../../../utils/consts'
import { safelyJsonParse } from '../../../utils/utils'
import { CheckCircleIcon } from '@heroicons/react/24/solid'
import { CodeBlock, tomorrow } from 'react-code-blocks'
import { SearchIcon } from '@chakra-ui/icons'
import { EmptyState, EmptyStateType } from '../../../components/tavern-base-ui/EmptyState'
import FreeTextSearch from '../../../components/tavern-base-ui/FreeTextSearch'

const TomeRadioGroup = (
{ label, data, selected, setSelected }: {
Expand All @@ -19,7 +19,7 @@ const TomeRadioGroup = (
const [filteredData, setFilteredData] = useState(data);
const [isExpanded, setIsExpanded] = useState(false);

const handleSearch = (data: Array<any>, text: string) => {
const handleSearch = (text: string) => {
const fd = data.filter((tome) => {
let tomeName = tome.name.toLowerCase();
let searchText = text.toLowerCase();
Expand All @@ -30,18 +30,13 @@ const TomeRadioGroup = (

return (
<div className="w-full">
<div className="mx-auto w-full">
<div className="mx-auto w-full flex flex-col gap-2">
<FreeTextSearch placeholder='Search by tome name' setSearch={handleSearch} />
<RadioGroup value={selected} onChange={setSelected} className="flex flex-col gap-3">
<RadioGroup.Label className="sr-only">
<Heading size="sm" >{label}</Heading>
</RadioGroup.Label>
<InputGroup>
<InputLeftElement pointerEvents='none'>
<SearchIcon color='gray.300' />
</InputLeftElement>
<Input placeholder='Search by tome name' colorScheme="purple" onChange={(event) => handleSearch(data, event.target.value)} />
</InputGroup>
<div className="space-y-2 md-scroll-container py-2 px-4">
<div className="space-y-2 md-scroll-container p-2">
{(filteredData.length === 0 && data.length > 0) &&
<EmptyState label='No tomes matching your search term' type={EmptyStateType.noMatches} />
}
Expand All @@ -51,7 +46,7 @@ const TomeRadioGroup = (
value={tome}
className={({ active, checked }) =>
`${active
? 'ring-2 ring-white/60 ring-offset-2 ring-offset-purple-300'
? 'ring-2 ring-white/60 ring-offset-2 ring-offset-purple-800'
: ''
}
bg-white relative flex cursor-pointer rounded-lg shadow-md focus:outline-none`
Expand All @@ -70,11 +65,16 @@ const TomeRadioGroup = (
<AccordionItem>
<h2>
<AccordionButton>
<div className='flex flex-row gap-2 w-full items-center'>
{(checked || isSavedInForm) && (
<div className="shrink-0 text-purple-500">
<CheckCircleIcon className="w-8 h-8" />
<div className='flex flex-row gap-4 w-full items-center'>
{(checked || isSavedInForm) ? (
<div className="shrink-0 text-purple-800">
<CheckCircleIcon className="w-6 h-6" />
</div>
) : (
<span
aria-hidden="true"
className={`h-6 w-6 rounded-full border-2 border-black border-opacity-10 ${(checked || isSavedInForm) && 'bg-purple-800'}`}
/>
)}
<Box as="div" flex='1' textAlign='left' className='flex flex-col w-full gap-1'>
<RadioGroup.Label
Expand Down