Skip to content

Commit

Permalink
now checks open in a card beside the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
danielc-n committed Sep 20, 2024
1 parent dc88d7b commit 038a173
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const TranslationHelps = ({
},
} = useContext(ReferenceContext);
const { t } = useTranslation();
console.log("selectedResource ==",selectedResource)

const translationQuestionsPath = `${(chapter < 10) ? (`0${ chapter}`)
: chapter}/${(verse < 10) ? (`0${ verse}`) : verse}.md`;
Expand Down
19 changes: 14 additions & 5 deletions renderer/src/components/EditorPage/TextEditor/ChecksPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Dialog, Transition } from '@headlessui/react';
import { SnackBar } from '@/components/SnackBar';
import { Disclosure } from '@headlessui/react';
import { ChevronUpIcon } from '@heroicons/react/20/solid';
import { randomUUID } from 'crypto';
// import * as logger from '../../logger';

export default function ChecksPopup({
Expand All @@ -29,17 +30,25 @@ export default function ChecksPopup({
useEffect(() => {
if (isArray) {
let tmpGroupedData = {};
console.log(content);
let currentName = "";
for (let check of content) {
console.log("check==", check);
if (check.issues.length > 0) {
tmpGroupedData[check.qName] = check.issues
// console.log("check==", check);
currentName = check.name;
if (!tmpGroupedData[currentName]) {
tmpGroupedData[currentName] = [];
}
delete check.name;
tmpGroupedData[currentName].push(check);
}
console.log("tmpGroupedData ==", tmpGroupedData)
setGroupedData(tmpGroupedData);
}
}, [content]);

useEffect(() => {
console.log("groupedData ==", groupedData)
}, [groupedData]);

// const groupedData = () => {
// let group = {};
// if (isArray) {
Expand Down Expand Up @@ -98,7 +107,7 @@ export default function ChecksPopup({
<Disclosure.Button className='flex justify-between w-full px-4 py-2 text-sm font-medium text-left text-gray-700 bg-gray-200 rounded-lg hover:bg-gray-300 focus:outline-none focus-visible:ring focus-visible:ring-purple-500 focus-visible:ring-opacity-75'>
<span>{key}</span>
<ChevronUpIcon
className={`${open ? 'transform rotate-180' : ''
className={`${open ? '' : 'transform rotate-180'
} w-5 h-5 text-gray-500`}
/>
</Disclosure.Button>
Expand Down
26 changes: 24 additions & 2 deletions renderer/src/layouts/editor/EditorSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import MenuDropdown from '@/components/MenuDropdown/MenuDropdown';
import AdjustmentsVerticalIcon from '@/icons/Common/AdjustmentsVertical.svg';
import XMarkIcon from '@/icons/Common/XMark.svg';
import SquaresPlusIcon from '@/icons/Common/SquaresPlus.svg';
import { Cog8ToothIcon } from '@heroicons/react/24/outline';
import ConfirmationModal from './ConfirmationModal';
import * as logger from '../../logger';

Expand Down Expand Up @@ -328,9 +329,9 @@ export default function EditorSection({
</div>

{loadResource === false ? (
<div className="w-full h-full flex items-center justify-center prose-sm p-4 text-xl">
<div className="w-full h-full flex items-center justify-center prose-sm p-4 text-xl">
<div className="text-center">
<div className="text-xs uppercase pb-4">
<div className="p-5 text-xs uppercase pb-4">
{t('label-editor-load-module')}
</div>
<button
Expand All @@ -344,6 +345,27 @@ export default function EditorSection({
/>
</button>
</div>
<div className="text-center">
<div className="p-5 text-xs uppercase pb-4">
{"Open checks"}
</div>
<button
type="button"
className="p-4 bg-gray-200 rounded-lg ring-offset-1"
onClick={() => {
let copyRefResources = referenceResources;
referenceResources.selectedResource = 'checks';
setLoadResource(true);
setReferenceResources(referenceResources);
}}
>
<Cog8ToothIcon
aria-label="close-lock"
className="h-5 w-5"
aria-hidden="true"
/>
</button>
</div>
</div>
) : (
<div
Expand Down

0 comments on commit 038a173

Please sign in to comment.