Skip to content

Commit ec83fe5

Browse files
authored
Merge pull request #896 from CDLUC3/feature/710/JS-static-page-for-research-outputs
Feature/710/js static page for research outputs
2 parents 09c6061 + 3ea073d commit ec83fe5

29 files changed

+7660
-122
lines changed

app/[locale]/template/[templateId]/q/new/__tests__/page.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe("QuestionTypeSelectPage", () => {
111111
expect(questionTypeCard2Description).toBeInTheDocument();
112112
expect(questionTypeCard3).toBeInTheDocument();
113113
expect(questionTypeCard3Description).toBeInTheDocument();
114-
expect(selectButtons.length).toBe(16);
114+
expect(selectButtons.length).toBe(17);
115115
});
116116

117117
it('should show filtered list when user clicks Search button', async () => {

app/[locale]/template/[templateId]/q/new/page.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,27 @@ const QuestionTypeSelectPage: React.FC = () => {
220220
handleSelect={handleSelect}
221221
/>
222222
))}
223+
{/** This is temporary, until we add research output question type to questionTypes */}
224+
<QuestionTypeCard
225+
key="researchOutput"
226+
questionType={{
227+
type: "researchOutput",
228+
title: "Research Output",
229+
usageDescription: "A description of the research output.",
230+
defaultJSON: {
231+
meta: {
232+
schemaVersion: "1.0",
233+
},
234+
type: "researchOutput",
235+
title: "Research Output",
236+
description: "",
237+
helpText: "",
238+
required: false,
239+
}
240+
} as any} // eslint-disable-line @typescript-eslint/no-explicit-any
241+
handleSelect={handleSelect}
242+
/>
243+
223244
</>
224245
)
225246
}

app/types/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { ReactNode } from "react";
22
import { PlanSectionProgress, TemplateVisibility, PlanFeedback, ProjectFundingStatus } from "@/generated/graphql";
33
import { AffiliationSearchQuestionType, AnyQuestionType } from '@dmptool/types';
44

5+
// Re-export types from questionAdd module
6+
export * from './questionAdd';
7+
58
export interface EmailInterface {
69
id?: number | null;
710
email: string;

app/types/questionAdd.ts

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
export type DataFlagsConfig = {
2+
showSensitiveData: boolean;
3+
showPersonalData: boolean;
4+
mode: 'sensitiveOnly' | 'personalOnly' | 'both';
5+
};
6+
7+
export type RepoConfig = {
8+
hasCustomRepos: boolean;
9+
customRepos: string[];
10+
}
11+
12+
export type MetaDataConfig = {
13+
hasCustomStandards: boolean;
14+
customStandards: string[];
15+
}
16+
17+
export type StandardField = {
18+
id: string;
19+
label: string;
20+
enabled: boolean;
21+
required?: boolean;
22+
defaultValue?: string;
23+
placeholder?: string;
24+
helpText?: string;
25+
maxLength?: string;
26+
value?: string;
27+
licensesConfig?: LicensesConfig;
28+
outputTypeConfig?: {
29+
mode: 'defaults' | 'mine' | 'addToDefaults';
30+
selectedDefaults: string[];
31+
customTypes: string[];
32+
};
33+
flagsConfig?: DataFlagsConfig;
34+
repoConfig?: RepoConfig;
35+
metaDataConfig?: MetaDataConfig;
36+
};
37+
38+
export interface RepositoryInterface {
39+
id: number;
40+
name: string;
41+
description: string;
42+
url: string;
43+
contact: string;
44+
access: string;
45+
identifier: string;
46+
tags: string[];
47+
}
48+
49+
export interface RepositoryFieldInterface {
50+
id: string;
51+
label: string;
52+
enabled: boolean;
53+
placeholder?: string;
54+
helpText?: string;
55+
value?: string;
56+
repoConfig?: {
57+
hasCustomRepos: boolean;
58+
customRepos: string[];
59+
}
60+
}
61+
62+
export interface MetaDataStandardInterface {
63+
id: number;
64+
name: string;
65+
description: string;
66+
url: string;
67+
}
68+
69+
export interface MetaDataStandardFieldInterface {
70+
id: string;
71+
label: string;
72+
enabled: boolean;
73+
helpText?: string;
74+
metaDataConfig: {
75+
hasCustomStandards: boolean;
76+
customStandards: string[];
77+
}
78+
}
79+
80+
export type LicensesConfig = {
81+
mode: 'defaults' | 'addToDefaults';
82+
selectedDefaults: string[];
83+
customTypes: string[];
84+
};
85+
86+
export interface LicenseFieldProps {
87+
field: StandardField;
88+
newLicenseType: string;
89+
setNewLicenseType: (value: string) => void;
90+
onModeChange: (mode: 'defaults' | 'addToDefaults') => void;
91+
onAddCustomType: () => void;
92+
onRemoveCustomType: (type: string) => void;
93+
}
94+
95+
export interface OutputTypeFieldConfigProps {
96+
field: StandardField;
97+
newOutputType: string;
98+
setNewOutputType: (value: string) => void;
99+
onModeChange: (mode: 'defaults' | 'mine' | 'addToDefaults') => void;
100+
onAddCustomType: () => void;
101+
onRemoveCustomType: (type: string) => void;
102+
}

0 commit comments

Comments
 (0)