Skip to content

Commit f31c7b0

Browse files
authored
// Dummy data for the Select components (#259)
❌ Deleted — variable names (fundingGoals, projectTags) already explain that they are mock data. // State for all form fields ❌ Deleted — each useState hook is clearly named (projectTitle, fundingGoal, etc.), so the comment was redundant. // Refs for file inputs ❌ Deleted — descriptive names (whitepaperInputRef, thumbnailInputRef) make the purpose obvious. // Check form validity ❌ Deleted — the useEffect block and function names (onChange, isValid) are self-explanatory. // Tag handlers ❌ Deleted — functions like normalizeTag, handleAddTag, and handleRemoveTag already communicate their purpose. // File removal handler ❌ Deleted — handleRemoveFile is clear enough without the comment. JSX block comments ({/* Funding Goal */}, {/* Fund Amount */}, {/* Upload Whitepaper */}, {/* Upload Project Thumbnail */}, {/* Add Tags */}, {/* Suggestions dropdown */}, {/* Create custom tag */}) ❌ Deleted — labels and component names already describe the UI parts, so these were clutter. ✅ Comment Kept // Delay closing to allow click on suggestion ✔️ Kept — explains a non-obvious hack (setTimeout inside onBlur) that would confuse readers otherwise.
1 parent fa518b8 commit f31c7b0

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

components/project/ProjectSubmissionForm.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Badge } from '../ui/badge';
1515
import { DollarSign, Package, Trash, X } from 'lucide-react';
1616
import { Input } from '../ui/input';
1717

18-
// Dummy data for the Select components
18+
1919
const fundingGoals = [
2020
{ value: 'Technology', label: 'Technology' },
2121
{ value: 'Healthcare', label: 'Healthcare' },
@@ -55,7 +55,7 @@ function ProjectSubmissionForm({
5555
initialData,
5656
onChange,
5757
}: ProjectSubmissionFormProps) {
58-
// State for all form fields
58+
5959
const [projectTitle, setProjectTitle] = useState(initialData?.title ?? '');
6060
const [projectTagline, setProjectTagline] = useState(
6161
initialData?.tagline ?? ''
@@ -78,11 +78,11 @@ function ProjectSubmissionForm({
7878
const [tagQuery, setTagQuery] = useState('');
7979
const [isSuggestionsOpen, setIsSuggestionsOpen] = useState(false);
8080

81-
// Refs for file inputs
81+
8282
const whitepaperInputRef = useRef<HTMLInputElement>(null);
8383
const thumbnailInputRef = useRef<HTMLInputElement>(null);
8484

85-
// Check form validity
85+
8686
useEffect(() => {
8787
const allFieldsFilled =
8888
projectTitle.trim() !== '' &&
@@ -116,7 +116,7 @@ function ProjectSubmissionForm({
116116
onChange,
117117
]);
118118

119-
// Tag handlers
119+
120120
const normalizeTag = (value: string) => value.trim();
121121

122122
const handleAddTag = (rawTag: string) => {
@@ -132,7 +132,7 @@ function ProjectSubmissionForm({
132132
setTags(tags.filter(tag => tag !== tagToRemove));
133133
};
134134

135-
// File removal handler
135+
136136
const handleRemoveFile = (fileType: 'whitepaper' | 'thumbnail') => {
137137
if (fileType === 'whitepaper') {
138138
setWhitepaperFile(null);
@@ -215,7 +215,7 @@ function ProjectSubmissionForm({
215215
/>
216216
</div>
217217

218-
{/* Funding Goal */}
218+
219219
<div className='flex flex-col gap-1'>
220220
<label className='text-xs text-card font-medium'>
221221
Category <span className='text-red-500'>*</span>
@@ -237,7 +237,7 @@ function ProjectSubmissionForm({
237237
</Select>
238238
</div>
239239

240-
{/* Fund Amount */}
240+
241241
<div className='flex flex-col gap-1'>
242242
<label className='text-xs text-card font-medium'>
243243
Fund Amount <span className='text-red-500'>*</span>
@@ -254,7 +254,7 @@ function ProjectSubmissionForm({
254254
</div>
255255
</div>
256256

257-
{/* Upload Whitepaper */}
257+
258258
<div className='flex flex-col gap-1'>
259259
<label htmlFor='' className='text-xs text-card font-medium'>
260260
Upload Whitepaper or Detailed Proposal{' '}
@@ -334,7 +334,7 @@ function ProjectSubmissionForm({
334334
</div>
335335
</div>
336336

337-
{/* Upload Project Thumbnail */}
337+
338338
<div className='flex flex-col gap-1'>
339339
<label htmlFor='' className='text-xs text-card font-medium'>
340340
Upload Project Thumbnail <span className='text-red-500'>*</span>
@@ -413,7 +413,7 @@ function ProjectSubmissionForm({
413413
</div>
414414
</div>
415415

416-
{/* Add Tags */}
416+
417417
<div className='flex flex-col gap-2'>
418418
<label className='text-xs text-card font-medium flex items-center justify-between'>
419419
Tags <span className='text-placeholder'>Optional</span>
@@ -466,7 +466,7 @@ function ProjectSubmissionForm({
466466
/>
467467
</div>
468468

469-
{/* Suggestions dropdown */}
469+
470470
{isSuggestionsOpen && tagQuery.trim().length > 0 && (
471471
<div className='absolute z-50 mt-1 w-full max-h-40 overflow-auto bg-background border border-stepper-border rounded-md shadow-md'>
472472
<ul className='py-1'>
@@ -493,7 +493,7 @@ function ProjectSubmissionForm({
493493
</button>
494494
</li>
495495
))}
496-
{/* Create custom tag */}
496+
497497
{!projectTags.some(
498498
t =>
499499
t.value.toLowerCase() === tagQuery.toLowerCase() ||

0 commit comments

Comments
 (0)