Skip to content

Commit

Permalink
Merge pull request #192 from bible-technology/ft/align-bible
Browse files Browse the repository at this point in the history
added aligned bible support
  • Loading branch information
vipinpaul authored Oct 25, 2023
2 parents 06a91e0 + 9116118 commit 22291fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import { ChevronUpDownIcon } from '@heroicons/react/24/solid';

function CustomMultiComboBox({
selectedList, setSelectedList, customData, filterParams = 'name', multiSelect = false, dropArrow = false, showLangCode = { show: false, langkey: 'lc' },
placeholder = 'Select Language',
}) {
let filteredData = [];
const [query, setQuery] = useState('');
// eslint-disable-next-line no-unused-vars
const [isActive, setIsActive] = useState(false);
if (customData.length === 1) {
setSelectedList(customData[0]);
setSelectedList(customData);
} else if (customData.length > 1) {
// eslint-disable-next-line no-nested-ternary
filteredData = (query === '')
Expand All @@ -32,7 +33,7 @@ function CustomMultiComboBox({
className="w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0"
// displayValue={(language) => language?.ang}
displayValue={(selectedList) => `${selectedList.length > 0 ? `${selectedList[0][filterParams]}${multiSelect ? '... click for more' : '' }` : ''}`}
placeholder="Select Language"
placeholder={placeholder}
aria-label="custom-dropdown"
onFocus={() => !open && setIsActive(true)}
onBlur={() => setIsActive(false)}
Expand All @@ -55,7 +56,7 @@ function CustomMultiComboBox({
{filteredData.length > 0
? filteredData.map((data) => (
// <Combobox.Option key={data?.id || data?.pk} className={`${selectedList.includes(data) ? 'bg-gray-400' : ''} hover:bg-gray-300 p-1`} value={data}>
<Combobox.Option key={data?.id || data?.pk} className=" hover:bg-gray-300 p-1" value={data} aria-label={data[filterParams]}>
<Combobox.Option key={data?.name || data?.id || data?.pk} className=" hover:bg-gray-300 p-1" value={data} aria-label={data[filterParams]}>
{data[filterParams] }
{' '}
{showLangCode.show && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import { environment } from '../../../../environment';

const subjectTypeArray = {
bible: [
{ id: 1, name: 'Aligned Bible' },
{ id: 2, name: 'Bible' },
// { id: 1, name: 'Aligned Bible' },
// { id: 3, name: 'Hebrew Old Testament' },
// { id: 4, name: 'Greek New Testament' },
],
Expand Down Expand Up @@ -171,12 +171,12 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD
logger.debug('DownloadResourcePopUp.js', 'save filter and call fetch');
if (!downloadStarted) {
// setLoadFilterDiv(!loadFilterDiv);
if (selectedLangFilter.length > 0 || selectedTypeFilter.length > 0) {
if (selectedLangFilter.length > 0 && selectedTypeFilter.length > 0) {
await fetchResource(true);
} else {
setOpenSnackBar(true);
setNotify('warning');
setSnackText('No filter applied, please select filter');
setSnackText('Please select All filters');
}
} else {
setOpenSnackBar(true);
Expand Down Expand Up @@ -336,6 +336,8 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD
selectedList={selectedTypeFilter}
setSelectedList={setSelectedTypeFilter}
customData={selectResource === 'bible' ? subjectTypeArray.bible : subjectTypeArray.obs}
placeholder="Select Types"
dropArrow
multiSelect
/>
</div>
Expand Down

0 comments on commit 22291fb

Please sign in to comment.