diff --git a/src/components/Contribute/Knowledge/DownloadAttribution/DownloadAttribution.tsx b/src/components/Contribute/Knowledge/DownloadAttribution/DownloadAttribution.tsx index 55eb4073..3f0fe267 100644 --- a/src/components/Contribute/Knowledge/DownloadAttribution/DownloadAttribution.tsx +++ b/src/components/Contribute/Knowledge/DownloadAttribution/DownloadAttribution.tsx @@ -1,19 +1,15 @@ import React from 'react'; -import { validateFields } from '../validation'; -import { ActionGroupAlertContent, KnowledgeFormData } from '..'; +import { KnowledgeFormData } from '..'; import { DropdownItem } from '@patternfly/react-core/dist/esm/components/Dropdown/DropdownItem'; import FileIcon from '@patternfly/react-icons/dist/esm/icons/file-icon'; interface Props { - disableAction: boolean; knowledgeFormData: KnowledgeFormData; - setActionGroupAlertContent: React.Dispatch>; } -const DownloadAttribution: React.FC = ({ disableAction, knowledgeFormData, setActionGroupAlertContent }) => { +const DownloadAttribution: React.FC = ({ knowledgeFormData }) => { const handleDownloadAttribution = () => { // Because I have overly complicated the validatedFields function all fields are being checked and not just the attribution ones here. Not ideal. - if (!validateFields(knowledgeFormData, setActionGroupAlertContent)) return; const attributionContent = `Title of work: ${knowledgeFormData.titleWork} Link to work: ${knowledgeFormData.linkWork} @@ -33,7 +29,7 @@ const DownloadAttribution: React.FC = ({ disableAction, knowledgeFormData }; return ( - + Attribution File ); diff --git a/src/components/Contribute/Knowledge/DownloadDropdown/DownloadDropdown.tsx b/src/components/Contribute/Knowledge/DownloadDropdown/DownloadDropdown.tsx index 918a1596..c7aa0dca 100644 --- a/src/components/Contribute/Knowledge/DownloadDropdown/DownloadDropdown.tsx +++ b/src/components/Contribute/Knowledge/DownloadDropdown/DownloadDropdown.tsx @@ -4,22 +4,15 @@ import { DropdownList } from '@patternfly/react-core/dist/dynamic/components/Dro import { MenuToggle, MenuToggleElement } from '@patternfly/react-core/dist/dynamic/components/MenuToggle'; import DownloadYaml from '../DownloadYaml/DownloadYaml'; import DownloadAttribution from '../DownloadAttribution/DownloadAttribution'; -import { ActionGroupAlertContent, KnowledgeFormData } from '..'; +import { KnowledgeFormData } from '..'; import DownloadIcon from '@patternfly/react-icons/dist/esm/icons/download-icon'; interface Props { - disableAction: boolean; knowledgeFormData: KnowledgeFormData; - setActionGroupAlertContent: React.Dispatch>; githubUsername: string | undefined; } -export const DownloadDropdown: React.FunctionComponent = ({ - disableAction, - knowledgeFormData, - setActionGroupAlertContent, - githubUsername -}) => { +export const DownloadDropdown: React.FunctionComponent = ({ knowledgeFormData, githubUsername }) => { const [isOpen, setIsOpen] = React.useState(false); const onToggleClick = () => { @@ -45,17 +38,8 @@ export const DownloadDropdown: React.FunctionComponent = ({ shouldFocusToggleOnSelect > - - + + ); diff --git a/src/components/Contribute/Knowledge/DownloadYaml/DownloadYaml.tsx b/src/components/Contribute/Knowledge/DownloadYaml/DownloadYaml.tsx index c1fe5d01..c5990b9e 100644 --- a/src/components/Contribute/Knowledge/DownloadYaml/DownloadYaml.tsx +++ b/src/components/Contribute/Knowledge/DownloadYaml/DownloadYaml.tsx @@ -1,6 +1,5 @@ import React from 'react'; -import { validateFields } from '../validation'; -import { ActionGroupAlertContent, KnowledgeFormData } from '..'; +import { KnowledgeFormData } from '..'; import { KnowledgeYamlData } from '@/types'; import { KnowledgeSchemaVersion } from '@/types/const'; import { dumpYaml } from '@/utils/yamlConfig'; @@ -8,16 +7,12 @@ import { DropdownItem } from '@patternfly/react-core/dist/esm/components/Dropdow import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon'; interface Props { - disableAction: boolean; knowledgeFormData: KnowledgeFormData; - setActionGroupAlertContent: React.Dispatch>; githubUsername: string | undefined; } -const DownloadYaml: React.FC = ({ disableAction, knowledgeFormData, setActionGroupAlertContent, githubUsername }) => { +const DownloadYaml: React.FC = ({ knowledgeFormData, githubUsername }) => { const handleDownloadYaml = () => { - if (!validateFields(knowledgeFormData, setActionGroupAlertContent)) return; - const yamlData: KnowledgeYamlData = { created_by: githubUsername!, version: KnowledgeSchemaVersion, @@ -48,7 +43,7 @@ const DownloadYaml: React.FC = ({ disableAction, knowledgeFormData, setAc document.body.removeChild(a); }; return ( - + Yaml File ); diff --git a/src/components/Contribute/Knowledge/ViewDropdown/ViewDropdown.tsx b/src/components/Contribute/Knowledge/ViewDropdown/ViewDropdown.tsx index 31338306..8dd1d0af 100644 --- a/src/components/Contribute/Knowledge/ViewDropdown/ViewDropdown.tsx +++ b/src/components/Contribute/Knowledge/ViewDropdown/ViewDropdown.tsx @@ -13,12 +13,11 @@ import FileIcon from '@patternfly/react-icons/dist/dynamic/icons/file-icon'; import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon'; interface Props { - disableAction: boolean; knowledgeFormData: KnowledgeFormData; githubUsername: string | undefined; } -export const ViewDropdown: React.FunctionComponent = ({ disableAction, knowledgeFormData, githubUsername }) => { +export const ViewDropdown: React.FunctionComponent = ({ knowledgeFormData, githubUsername }) => { const [isOpen, setIsOpen] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false); const [modalContent, setModalContent] = useState(''); @@ -86,10 +85,10 @@ export const ViewDropdown: React.FunctionComponent = ({ disableAction, kn shouldFocusToggleOnSelect > - + YAML Content - + Attribution Content diff --git a/src/components/Contribute/Knowledge/index.tsx b/src/components/Contribute/Knowledge/index.tsx index 3d56cc05..74afb3ba 100644 --- a/src/components/Contribute/Knowledge/index.tsx +++ b/src/components/Contribute/Knowledge/index.tsx @@ -594,13 +594,8 @@ export const KnowledgeForm: React.FunctionComponent = ({ kno resetForm={resetForm} /> )} - - + + diff --git a/src/components/Contribute/Skill/DownloadAttribution/DownloadAttribution.tsx b/src/components/Contribute/Skill/DownloadAttribution/DownloadAttribution.tsx index 122ca227..1cfb3d67 100644 --- a/src/components/Contribute/Skill/DownloadAttribution/DownloadAttribution.tsx +++ b/src/components/Contribute/Skill/DownloadAttribution/DownloadAttribution.tsx @@ -1,19 +1,15 @@ import React from 'react'; -import { validateFields } from '../validation'; -import { ActionGroupAlertContent, SkillFormData } from '..'; +import { SkillFormData } from '..'; import { DropdownItem } from '@patternfly/react-core/dist/esm/components/Dropdown/DropdownItem'; import FileIcon from '@patternfly/react-icons/dist/esm/icons/file-icon'; interface Props { - disableAction: boolean; skillFormData: SkillFormData; - setActionGroupAlertContent: React.Dispatch>; } -const DownloadAttribution: React.FC = ({ disableAction, skillFormData, setActionGroupAlertContent }) => { +const DownloadAttribution: React.FC = ({ skillFormData }) => { const handleDownloadAttribution = () => { // Because I have overly complicated the validatedFields function all fields are being checked and not just the attribution ones here. Not ideal. - if (!validateFields(skillFormData, setActionGroupAlertContent)) return; const attributionContent = `Title of work: ${skillFormData.titleWork} License of the work: ${skillFormData.licenseWork} @@ -31,7 +27,7 @@ const DownloadAttribution: React.FC = ({ disableAction, skillFormData, se }; return ( - + Attribution File ); diff --git a/src/components/Contribute/Skill/DownloadDropdown/DownloadDropdown.tsx b/src/components/Contribute/Skill/DownloadDropdown/DownloadDropdown.tsx index 0398b00e..41f39e55 100644 --- a/src/components/Contribute/Skill/DownloadDropdown/DownloadDropdown.tsx +++ b/src/components/Contribute/Skill/DownloadDropdown/DownloadDropdown.tsx @@ -4,17 +4,15 @@ import { DropdownList } from '@patternfly/react-core/dist/dynamic/components/Dro import { MenuToggle, MenuToggleElement } from '@patternfly/react-core/dist/dynamic/components/MenuToggle'; import DownloadYaml from '../DownloadYaml/DownloadYaml'; import DownloadAttribution from '../DownloadAttribution/DownloadAttribution'; -import { ActionGroupAlertContent, SkillFormData } from '..'; +import { SkillFormData } from '..'; import DownloadIcon from '@patternfly/react-icons/dist/esm/icons/download-icon'; interface Props { - disableAction: boolean; skillFormData: SkillFormData; - setActionGroupAlertContent: React.Dispatch>; githubUsername: string | undefined; } -export const DownloadDropdown: React.FunctionComponent = ({ disableAction, skillFormData, setActionGroupAlertContent, githubUsername }) => { +export const DownloadDropdown: React.FunctionComponent = ({ skillFormData, githubUsername }) => { const [isOpen, setIsOpen] = React.useState(false); const onToggleClick = () => { @@ -40,13 +38,8 @@ export const DownloadDropdown: React.FunctionComponent = ({ disableAction shouldFocusToggleOnSelect > - - + + ); diff --git a/src/components/Contribute/Skill/DownloadYaml/DownloadYaml.tsx b/src/components/Contribute/Skill/DownloadYaml/DownloadYaml.tsx index 5b1900fb..321fd207 100644 --- a/src/components/Contribute/Skill/DownloadYaml/DownloadYaml.tsx +++ b/src/components/Contribute/Skill/DownloadYaml/DownloadYaml.tsx @@ -1,6 +1,5 @@ import React from 'react'; -import { validateFields } from '../validation'; -import { ActionGroupAlertContent, SkillFormData } from '..'; +import { SkillFormData } from '..'; import { SkillYamlData } from '@/types'; import { dumpYaml } from '@/utils/yamlConfig'; import { DropdownItem } from '@patternfly/react-core/dist/esm/components/Dropdown/DropdownItem'; @@ -8,16 +7,12 @@ import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon'; import { SkillSchemaVersion } from '@/types/const'; interface Props { - disableAction: boolean; skillFormData: SkillFormData; - setActionGroupAlertContent: React.Dispatch>; githubUsername: string | undefined; } -const DownloadYaml: React.FC = ({ disableAction, skillFormData, setActionGroupAlertContent, githubUsername }) => { +const DownloadYaml: React.FC = ({ skillFormData, githubUsername }) => { const handleDownloadYaml = () => { - if (!validateFields(skillFormData, setActionGroupAlertContent)) return; - const yamlData: SkillYamlData = { created_by: githubUsername!, version: SkillSchemaVersion, @@ -40,7 +35,7 @@ const DownloadYaml: React.FC = ({ disableAction, skillFormData, setAction document.body.removeChild(a); }; return ( - + Yaml File ); diff --git a/src/components/Contribute/Skill/ViewDropdown/ViewDropdown.tsx b/src/components/Contribute/Skill/ViewDropdown/ViewDropdown.tsx index 8c532b21..29c81e07 100644 --- a/src/components/Contribute/Skill/ViewDropdown/ViewDropdown.tsx +++ b/src/components/Contribute/Skill/ViewDropdown/ViewDropdown.tsx @@ -13,12 +13,11 @@ import FileIcon from '@patternfly/react-icons/dist/dynamic/icons/file-icon'; import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon'; interface Props { - disableAction: boolean; skillFormData: SkillFormData; githubUsername: string | undefined; } -export const ViewDropdown: React.FunctionComponent = ({ disableAction, skillFormData, githubUsername }) => { +export const ViewDropdown: React.FunctionComponent = ({ skillFormData, githubUsername }) => { const [isOpen, setIsOpen] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false); const [modalContent, setModalContent] = useState(''); @@ -77,10 +76,10 @@ export const ViewDropdown: React.FunctionComponent = ({ disableAction, sk shouldFocusToggleOnSelect > - + YAML Content - + Attribution Content diff --git a/src/components/Contribute/Skill/index.tsx b/src/components/Contribute/Skill/index.tsx index 469cfc32..50943b58 100644 --- a/src/components/Contribute/Skill/index.tsx +++ b/src/components/Contribute/Skill/index.tsx @@ -460,13 +460,8 @@ export const SkillForm: React.FunctionComponent = ({ skillEditFo resetForm={resetForm} /> )} - - + +