Skip to content

Commit 27e6aff

Browse files
authored
Merge pull request #386 from CivicDataLab/fix/collabrative-card
Text Size, Required Feild and Language Selection
2 parents 3a20336 + b8f59c5 commit 27e6aff

5 files changed

Lines changed: 48 additions & 39 deletions

File tree

app/[locale]/dashboard/[entityType]/[entitySlug]/aimodels/edit/[id]/details/page.tsx

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,24 @@ const UpdateAIModelMutation: any = graphql(`
9696
}
9797
`);
9898

99+
const LANGUAGE_OPTIONS = [
100+
{ label: 'English', value: 'en' },
101+
{ label: 'Hindi', value: 'hi' },
102+
{ label: 'Spanish', value: 'es' },
103+
{ label: 'French', value: 'fr' },
104+
{ label: 'German', value: 'de' },
105+
{ label: 'Chinese', value: 'zh' },
106+
{ label: 'Japanese', value: 'ja' },
107+
{ label: 'Korean', value: 'ko' },
108+
{ label: 'Arabic', value: 'ar' },
109+
{ label: 'Portuguese', value: 'pt' },
110+
{ label: 'Russian', value: 'ru' },
111+
{ label: 'Tamil', value: 'ta' },
112+
{ label: 'Telugu', value: 'te' },
113+
{ label: 'Bengali', value: 'bn' },
114+
{ label: 'Marathi', value: 'mr' },
115+
];
116+
99117
export default function AIModelDetailsPage() {
100118
const params = useParams<{
101119
entityType: string;
@@ -273,7 +291,8 @@ export default function AIModelDetailsPage() {
273291
maxTokens: model.maxTokens?.toString() || '',
274292
supportedLanguages:
275293
model.supportedLanguages?.map((l: string) => ({
276-
label: l,
294+
label:
295+
LANGUAGE_OPTIONS.find((option) => option.value === l)?.label || l,
277296
value: l,
278297
})) || [],
279298
modelWebsite: metadata.modelWebsite || '',
@@ -289,6 +308,7 @@ export default function AIModelDetailsPage() {
289308
}, [model]);
290309

291310
const handleInputChange = (field: string, value: any) => {
311+
console.log('handleInputChange', field, value);
292312
setFormData((prev) => ({ ...prev, [field]: value }));
293313
setStatus('unsaved');
294314
};
@@ -324,7 +344,9 @@ export default function AIModelDetailsPage() {
324344

325345
// Ensure access type is always 'open' (required field)
326346
if (dataToUse.accessType !== 'open') {
327-
toast('Open access is required for all models',{id: OPEN_ACCESS_REQUIRED_TOAST_ID});
347+
toast('Open access is required for all models', {
348+
id: OPEN_ACCESS_REQUIRED_TOAST_ID,
349+
});
328350
setStatus('unsaved');
329351
return;
330352
}
@@ -396,23 +418,7 @@ export default function AIModelDetailsPage() {
396418
{ label: '131072', value: '131072' },
397419
];
398420

399-
const languageOptions = [
400-
{ label: 'English', value: 'en' },
401-
{ label: 'Hindi', value: 'hi' },
402-
{ label: 'Spanish', value: 'es' },
403-
{ label: 'French', value: 'fr' },
404-
{ label: 'German', value: 'de' },
405-
{ label: 'Chinese', value: 'zh' },
406-
{ label: 'Japanese', value: 'ja' },
407-
{ label: 'Korean', value: 'ko' },
408-
{ label: 'Arabic', value: 'ar' },
409-
{ label: 'Portuguese', value: 'pt' },
410-
{ label: 'Russian', value: 'ru' },
411-
{ label: 'Tamil', value: 'ta' },
412-
{ label: 'Telugu', value: 'te' },
413-
{ label: 'Bengali', value: 'bn' },
414-
{ label: 'Marathi', value: 'mr' },
415-
];
421+
const languageOptions = LANGUAGE_OPTIONS;
416422

417423
const licenseOptions = [
418424
{ label: 'Click to select from dropdown', value: '' },
@@ -434,7 +440,7 @@ export default function AIModelDetailsPage() {
434440
</div>
435441
);
436442
}
437-
const OPEN_ACCESS_REQUIRED_TOAST_ID = SAVE_SUCCESS_TOAST_ID;
443+
const OPEN_ACCESS_REQUIRED_TOAST_ID = SAVE_SUCCESS_TOAST_ID;
438444
return (
439445
<div className="flex flex-col gap-4 py-6">
440446
{/* Model Type & Domain - side by side */}
@@ -536,6 +542,7 @@ const OPEN_ACCESS_REQUIRED_TOAST_ID = SAVE_SUCCESS_TOAST_ID;
536542
label="Tags"
537543
creatable
538544
selectedValue={formData.tags}
545+
requiredIndicator
539546
onChange={(value) => {
540547
setIsTagsListUpdated(true);
541548
handleInputChange('tags', value);
@@ -599,6 +606,7 @@ const OPEN_ACCESS_REQUIRED_TOAST_ID = SAVE_SUCCESS_TOAST_ID;
599606
}
600607
key={`geographies-${getGeographiesList.data?.geographies?.length || 0}-${formData.geographies.length}`}
601608
label="Locations / Geography"
609+
requiredIndicator
602610
selectedValue={formData.geographies}
603611
onChange={(value) => {
604612
handleInputChange('geographies', value);

app/[locale]/dashboard/[entityType]/[entitySlug]/aimodels/edit/[id]/publish/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ export default function PublishPage() {
393393
{meta.label}:
394394
</Text>
395395
<Text
396-
variant="bodyLg"
396+
variant="bodyMd"
397397
className="lg:basis-4/5"
398398
>
399399
{meta.value}

app/[locale]/dashboard/[entityType]/[entitySlug]/collaboratives/edit/[id]/publish/Details.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const Details = ({ data }: { data: any }) => {
8383
className="text-primaryBlue underline"
8484
href={data.collaboratives[0].platformUrl}
8585
>
86-
<Text className="underline" color="highlight" variant="bodyLg">
86+
<Text className="underline" color="highlight" variant="bodyMd">
8787
{platformTitle?.trim() ? platformTitle : 'Visit Platform'}
8888
</Text>
8989
</Link>

app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/publish/Details.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const Details = ({ data }: { data: any }) => {
9494
<Text
9595
className="underline"
9696
color="highlight"
97-
variant="bodyLg"
97+
variant="bodyMd"
9898
>
9999
{platformTitle?.trim() ? platformTitle : 'Visit Platform'}
100100
</Text>

components/RichTextRenderer/RichTextRenderer.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client';
22

33
import React from 'react';
4+
45
import 'react-quill-new/dist/quill.snow.css';
56

67
interface RichTextRendererProps {
@@ -36,32 +37,32 @@ const RichTextRenderer: React.FC<RichTextRendererProps> = ({
3637
overflow-wrap: anywhere;
3738
word-break: break-word;
3839
padding: 0;
39-
font-size: 16px;
40+
font-size: 14px;
4041
line-height: 1.6;
4142
}
42-
43+
4344
.rich-text-content .ql-editor p {
4445
margin-bottom: 1em;
4546
}
46-
47+
4748
.rich-text-content .ql-editor h1 {
4849
font-size: 2em;
4950
font-weight: bold;
5051
margin-bottom: 0.5em;
5152
}
52-
53+
5354
.rich-text-content .ql-editor h2 {
5455
font-size: 1.5em;
5556
font-weight: bold;
5657
margin-bottom: 0.5em;
5758
}
58-
59+
5960
.rich-text-content .ql-editor h3 {
6061
font-size: 1.25em;
6162
font-weight: bold;
6263
margin-bottom: 0.5em;
6364
}
64-
65+
6566
.rich-text-content .ql-editor ul,
6667
.rich-text-content .ql-editor ol {
6768
list-style-position: outside;
@@ -80,7 +81,7 @@ const RichTextRenderer: React.FC<RichTextRendererProps> = ({
8081
.rich-text-content .ql-editor ol {
8182
list-style-type: decimal !important;
8283
}
83-
84+
8485
.rich-text-content .ql-editor li {
8586
margin-bottom: 0.25em;
8687
}
@@ -99,43 +100,43 @@ const RichTextRenderer: React.FC<RichTextRendererProps> = ({
99100
.rich-text-content .ql-editor li:not([data-list])::before {
100101
content: none !important;
101102
}
102-
103+
103104
.rich-text-content .ql-editor a {
104105
color: #3b82f6;
105106
text-decoration: underline;
106107
}
107-
108+
108109
.rich-text-content .ql-editor a:hover {
109110
color: #2563eb;
110111
}
111-
112+
112113
.rich-text-content.text-white .ql-editor a {
113114
color: #60a5fa;
114115
}
115-
116+
116117
.rich-text-content.text-white .ql-editor a:hover {
117118
color: #93c5fd;
118119
}
119-
120+
120121
.rich-text-content .ql-editor img {
121122
max-width: 100%;
122123
height: auto;
123124
margin: 1em 0;
124125
}
125-
126+
126127
.rich-text-content .ql-editor strong,
127128
.rich-text-content .ql-editor b {
128129
font-weight: 700 !important;
129130
}
130-
131+
131132
.rich-text-content .ql-editor em {
132133
font-style: italic;
133134
}
134-
135+
135136
.rich-text-content .ql-editor u {
136137
text-decoration: underline;
137138
}
138-
139+
139140
.rich-text-content .ql-editor s {
140141
text-decoration: line-through;
141142
}

0 commit comments

Comments
 (0)