mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-30 20:49:49 +02:00
fix: progress nudge count (#7133)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
import type { FormEvent } from 'react';
|
import type { FormEvent } from 'react';
|
||||||
import { useState } from 'react';
|
import { useId, useState } from 'react';
|
||||||
import { httpPost } from '../../lib/http';
|
import { httpPost } from '../../lib/http';
|
||||||
import { TOKEN_COOKIE_NAME, setAuthToken } from '../../lib/jwt';
|
import { TOKEN_COOKIE_NAME, setAuthToken } from '../../lib/jwt';
|
||||||
|
|
||||||
@@ -53,13 +53,16 @@ export function EmailLoginForm(props: EmailLoginFormProps) {
|
|||||||
setError(error?.message || 'Something went wrong. Please try again later.');
|
setError(error?.message || 'Something went wrong. Please try again later.');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const emailFieldId = `form:${useId()}`;
|
||||||
|
const passwordFieldId = `form:${useId()}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form className="w-full" onSubmit={handleFormSubmit}>
|
<form className="w-full" onSubmit={handleFormSubmit}>
|
||||||
<label htmlFor="email" className="sr-only">
|
<label htmlFor={emailFieldId} className="sr-only">
|
||||||
Email address
|
Email address
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="email"
|
id={emailFieldId}
|
||||||
name="email"
|
name="email"
|
||||||
type="email"
|
type="email"
|
||||||
autoComplete="email"
|
autoComplete="email"
|
||||||
@@ -69,11 +72,11 @@ export function EmailLoginForm(props: EmailLoginFormProps) {
|
|||||||
value={email}
|
value={email}
|
||||||
onInput={(e) => setEmail(String((e.target as any).value))}
|
onInput={(e) => setEmail(String((e.target as any).value))}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="password" className="sr-only">
|
<label htmlFor={passwordFieldId} className="sr-only">
|
||||||
Password
|
Password
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="password"
|
id={passwordFieldId}
|
||||||
name="password"
|
name="password"
|
||||||
type="password"
|
type="password"
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
|
@@ -11,7 +11,9 @@ export function ProgressNudge(props: ProgressNudgeProps) {
|
|||||||
const $totalRoadmapNodes = useStore(totalRoadmapNodes);
|
const $totalRoadmapNodes = useStore(totalRoadmapNodes);
|
||||||
const $roadmapProgress = useStore(roadmapProgress);
|
const $roadmapProgress = useStore(roadmapProgress);
|
||||||
|
|
||||||
const done = $roadmapProgress?.done?.length || 0;
|
const done =
|
||||||
|
($roadmapProgress?.done?.length || 0) +
|
||||||
|
($roadmapProgress?.skipped?.length || 0);
|
||||||
|
|
||||||
const hasProgress = done > 0;
|
const hasProgress = done > 0;
|
||||||
|
|
||||||
@@ -51,7 +53,8 @@ export function ProgressNudge(props: ProgressNudgeProps) {
|
|||||||
<span className="relative -top-[0.45px] mr-2 text-xs font-medium uppercase text-yellow-400">
|
<span className="relative -top-[0.45px] mr-2 text-xs font-medium uppercase text-yellow-400">
|
||||||
Progress
|
Progress
|
||||||
</span>
|
</span>
|
||||||
<span>{done > $totalRoadmapNodes ? $totalRoadmapNodes : done}</span> of <span>{$totalRoadmapNodes}</span> Done
|
<span>{done > $totalRoadmapNodes ? $totalRoadmapNodes : done}</span> of{' '}
|
||||||
|
<span>{$totalRoadmapNodes}</span> Done
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
|
Reference in New Issue
Block a user