fix: default false

feat/personal-progress
Arik Chakma 7 months ago
parent 4df03197ac
commit e3b64d7990
  1. 30
      src/components/CreateTeam/Step1.tsx
  2. 4
      src/components/TeamSettings/UpdateTeamForm.tsx

@ -48,9 +48,6 @@ export function Step1(props: Step1Props) {
const [teamSize, setTeamSize] = useState<ValidTeamSize>( const [teamSize, setTeamSize] = useState<ValidTeamSize>(
team?.teamSize || ('' as any), team?.teamSize || ('' as any),
); );
const [personalProgressOnly, setPersonalProgressOnly] = useState(
team?.personalProgressOnly ?? true,
);
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => { const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault(); e.preventDefault();
@ -77,7 +74,6 @@ export function Step1(props: Step1Props) {
}), }),
roadmapIds: [], roadmapIds: [],
bestPracticeIds: [], bestPracticeIds: [],
personalProgressOnly,
}, },
)); ));
@ -100,7 +96,6 @@ export function Step1(props: Step1Props) {
teamSize, teamSize,
linkedInUrl: linkedInUrl || undefined, linkedInUrl: linkedInUrl || undefined,
}), }),
personalProgressOnly,
}, },
)); ));
@ -121,7 +116,6 @@ export function Step1(props: Step1Props) {
}, },
type: selectedTeamType, type: selectedTeamType,
teamSize: teamSize!, teamSize: teamSize!,
personalProgressOnly,
}); });
} }
}; };
@ -243,30 +237,6 @@ export function Step1(props: Step1Props) {
</div> </div>
)} )}
<div className="mt-4 flex h-[42px] w-full items-center rounded-lg border border-gray-300 px-3 py-2 shadow-sm">
<label
htmlFor="personal-progress-only"
className="flex items-center gap-2 text-sm leading-none text-slate-500"
>
<input
type="checkbox"
name="personal-progress-only"
id="personal-progress-only"
checked={personalProgressOnly}
onChange={(e) =>
setPersonalProgressOnly((e.target as HTMLInputElement).checked)
}
/>
<span>Members can only see their personal progress</span>
</label>
</div>
{personalProgressOnly && (
<p className="mt-2 rounded-lg border border-orange-300 bg-orange-50 p-2 text-sm text-orange-700">
Only admins and managers will be able to see the progress of members
</p>
)}
{error && ( {error && (
<div className="mt-4 flex w-full flex-col"> <div className="mt-4 flex w-full flex-col">
<span className="text-sm text-red-500">{error}</span> <span className="text-sm text-red-500">{error}</span>

@ -24,7 +24,7 @@ export function UpdateTeamForm() {
const [gitHub, setGitHub] = useState(''); const [gitHub, setGitHub] = useState('');
const [teamType, setTeamType] = useState(''); const [teamType, setTeamType] = useState('');
const [teamSize, setTeamSize] = useState(''); const [teamSize, setTeamSize] = useState('');
const [personalProgressOnly, setPersonalProgressOnly] = useState(true); const [personalProgressOnly, setPersonalProgressOnly] = useState(false);
const validTeamSizes = [ const validTeamSizes = [
'0-1', '0-1',
'2-10', '2-10',
@ -92,7 +92,7 @@ export function UpdateTeamForm() {
setLinkedIn(response?.links?.linkedIn || ''); setLinkedIn(response?.links?.linkedIn || '');
setGitHub(response?.links?.github || ''); setGitHub(response?.links?.github || '');
setTeamType(response.type); setTeamType(response.type);
setPersonalProgressOnly(response.personalProgressOnly ?? true); setPersonalProgressOnly(response.personalProgressOnly ?? false);
if (response.teamSize) { if (response.teamSize) {
setTeamSize(response.teamSize); setTeamSize(response.teamSize);
} }

Loading…
Cancel
Save