Skip to content

Commit 411ce3c

Browse files
authored
Merge pull request #739 from jeff-phillips-18/content-fixes
Content fixes based on review
2 parents 4f3fa64 + e2f1647 commit 411ce3c

File tree

11 files changed

+46
-22
lines changed

11 files changed

+46
-22
lines changed

src/components/Common/WizardPageHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface Props {
88

99
const WizardPageHeader: React.FC<Props> = ({ title, description }) => (
1010
<div>
11-
<Content component="h4">{title}</Content>
11+
<Content component="h3">{title}</Content>
1212
<Content component="p">{description}</Content>
1313
</div>
1414
);

src/components/Contribute/AttributionInformation/AttributionInformation.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const AttributionInformation: React.FC<Props> = ({
9595
<FormGroup
9696
isRequired
9797
key={'attribution-info-details-title_work'}
98-
label="Title"
98+
label="Resource title"
9999
labelHelp={<WizardFormGroupLabelHelp bodyContent="The resource title is the title of the source document. " />}
100100
>
101101
<TextInput
@@ -121,7 +121,7 @@ const AttributionInformation: React.FC<Props> = ({
121121
<FormGroup
122122
isRequired
123123
key={'attribution-info-details-work_link'}
124-
label="Link to work"
124+
label="Resource link"
125125
labelHelp={<WizardFormGroupLabelHelp bodyContent="The resource link is a direct link to the source document." />}
126126
>
127127
<TextInput
@@ -161,7 +161,7 @@ const AttributionInformation: React.FC<Props> = ({
161161
<FormGroup
162162
isRequired
163163
key={'attribution-info-details-license'}
164-
label="License of the work"
164+
label="Resource license"
165165
labelHelp={
166166
<WizardFormGroupLabelHelp bodyContent="The resource license is the license type of the source document. This is usually a Creative Commons (CC) license, such as CC BY or CC BY-SA." />
167167
}

src/components/Contribute/ContributionWizard/ViewDropdownButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const ViewDropdownButton: React.FunctionComponent<Props> = ({ formData, c
104104
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
105105
<Button variant="secondary" ref={toggleRef} onClick={onToggleClick}>
106106
<Flex gap={{ default: 'gapMd' }}>
107-
<FlexItem>YAML/Attribution files</FlexItem>
107+
<FlexItem>Views contribution details</FlexItem>
108108
<FlexItem>
109109
<CaretDownIcon />
110110
</FlexItem>

src/components/Contribute/DetailsPage/DetailsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const DetailsPage: React.FC<Props> = ({
144144
icon={isSummaryInvalid ? <ExclamationCircleIcon /> : undefined}
145145
variant={isSummaryInvalid ? ValidatedOptions.error : ValidatedOptions.default}
146146
>
147-
{submissionSummary.trim().length ? (
147+
{!isSummaryInvalid || submissionSummary.trim().length ? (
148148
<>
149149
Must be {MAX_SUMMARY_CHARS} characters or less.
150150
{validSummary === ValidatedOptions.error && isSummaryInvalid

src/components/Contribute/Knowledge/DocumentInformation/DocumentInformation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const DocumentInformation: React.FC<Props> = ({ existingFiles, setExistingFiles,
2525
manuals, encyclopedias, journals, and websites.{' '}
2626
<Button
2727
variant="link"
28+
component="a"
2829
isInline
2930
href="https://docs.instructlab.ai/taxonomy/knowledge/#knowledge-yaml-examples"
3031
target="_blank"

src/components/Contribute/Knowledge/KnowledgeSeedExamples/KnowledgeSeedExamples.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const KnowledgeSeedExamples: React.FC<Props> = ({ isGithubMode, filesToUpload, u
8989
<Button
9090
variant="link"
9191
isInline
92+
component="a"
9293
href="https://docs.instructlab.ai/taxonomy/knowledge/#knowledge-yaml-examples"
9394
target="_blank"
9495
rel="noopener noreferrer"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { KnowledgeSeedExample } from '@/types';
22

33
export const getSeedExampleTitle = (seedExample: KnowledgeSeedExample, seedExampleIndex: number) =>
4-
seedExample.knowledgeFile?.filename
5-
? `Seed example ${seedExampleIndex + 1}: ${seedExample.knowledgeFile?.filename}`
4+
seedExample.context
5+
? `Seed example ${seedExampleIndex + 1}: ${seedExample.knowledgeFile?.filename || ''}`
66
: `Select context for seed example ${seedExampleIndex + 1}`;

src/components/Contribute/Knowledge/UploadFile.tsx

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
ModalHeader,
1414
Flex,
1515
FlexItem,
16-
MultipleFileUploadContext
16+
MultipleFileUploadContext,
17+
Content
1718
} from '@patternfly/react-core';
1819
import { UploadIcon } from '@patternfly/react-icons';
1920
import React, { useState, useEffect } from 'react';
@@ -219,6 +220,33 @@ export const UploadFile: React.FunctionComponent<UploadFileProps> = ({ existingF
219220

220221
const successfullyReadFileCount = readFileData.filter((fileData) => fileData.loadResult === 'success').length;
221222

223+
const getOverwriteWarningText = () => {
224+
if (filesToOverwrite.length > 1) {
225+
return (
226+
<>
227+
<Content component="p">The following files have already been uploaded in this contribution:</Content>
228+
<Content component="p">
229+
<Content component="ul">
230+
{filesToOverwrite.map((file) => (
231+
<Content component="li" key={file.name}>
232+
{file.name}
233+
</Content>
234+
))}
235+
</Content>
236+
</Content>
237+
<Content component="p">Uploading the new files will overwrite the existing files.</Content>
238+
</>
239+
);
240+
}
241+
242+
return (
243+
<Content component="p">
244+
A file with the name <b>{filesToOverwrite[0].name}</b> has already been uploaded in this contribution. Uploading the new file will overwrite
245+
the existing one.
246+
</Content>
247+
);
248+
};
249+
222250
return (
223251
<div>
224252
<MultipleFileUpload
@@ -310,20 +338,13 @@ export const UploadFile: React.FunctionComponent<UploadFileProps> = ({ existingF
310338
{showOverwriteModal && (
311339
<Modal
312340
isOpen
313-
title="Overwrite file"
314341
variant="small"
315342
aria-label="file overwrite warning"
316343
aria-labelledby="file-overwrite-warning-title"
317344
aria-describedby="file-overwrite-warning-variant"
318345
>
319-
<ModalHeader title="File Overwrite" labelId="file-overwrite-warning-title" titleIconVariant="warning" />
320-
<ModalBody id="file-overwrite-warning-variant">
321-
<p>
322-
Files [<strong>{filesToOverwrite.map((file) => file.name).join(', ')}</strong>] are already uploaded. Are you sure you want to
323-
overwrite the existing files?
324-
<br />
325-
</p>
326-
</ModalBody>
346+
<ModalHeader title="Overwrite file?" labelId="file-overwrite-warning-title" titleIconVariant="warning" />
347+
<ModalBody id="file-overwrite-warning-variant">{getOverwriteWarningText()}</ModalBody>
327348
<ModalFooter>
328349
<Button key="overwrite" variant="primary" onClick={overwriteFiles}>
329350
Overwrite

src/components/Contribute/Skill/SkillSeedExamples/SkillSeedExamples.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const SkillSeedExamples: React.FC<Props> = ({ seedExamples, onUpdateSeedExamples
6565
pairs.{' '}
6666
<Button
6767
variant="link"
68+
component="a"
6869
isInline
6970
href="https://docs.instructlab.ai/taxonomy/knowledge/#knowledge-yaml-examples"
7071
target="_blank"
@@ -85,7 +86,7 @@ const SkillSeedExamples: React.FC<Props> = ({ seedExamples, onUpdateSeedExamples
8586
<AccordionToggle onClick={() => toggleSeedExampleExpansion(seedExampleIndex)} id={`seed-example-toggle-${seedExampleIndex}`}>
8687
<Flex gap={{ default: 'gapMd' }} justifyContent={{ default: 'justifyContentSpaceBetween' }} style={{ width: '100%' }}>
8788
<FlexItem>
88-
Seed Example {seedExampleIndex + 1}{' '}
89+
Seed example {seedExampleIndex + 1}{' '}
8990
{seedExample.immutable ? <span style={{ color: 'var(--pf-t--global--color--status--danger--default)' }}>*</span> : null}
9091
</FlexItem>
9192
{!seedExample.immutable ? (

src/components/Contribute/Utils/validation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ export const validateKnowledgeFormFields = (
146146
const { success, currLength: length } = validateQuestionAndAnswerPairs(knowledgeFormData.seedExamples[index]);
147147
if (!success) {
148148
const actionGroupAlertContent: ActionGroupAlertContent = {
149-
title: `Seed Example ${index + 1} has an issue!`,
150-
message: `Total size of the Q and A pairs and context should not exceed 750 words (current size ${length}). Please provide shorter Q and A pairs or context.`,
149+
title: `Seed example ${index + 1} has an issue!`,
150+
message: `Total size of the question-and-answer pairs and context should not exceed 750 words (current size ${length}). Please provide shorter question-and-answer pairs or context.`,
151151
success: false
152152
};
153153
setActionGroupAlertContent(actionGroupAlertContent);

0 commit comments

Comments
 (0)