Skip to content

Commit 88c137c

Browse files
committed
fix: show scoreboard on mobile screen
1 parent 71afd1c commit 88c137c

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/components/sections/communities/overview/Sidebar.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useSelector } from "@/hooks/useTypedSelector";
22
import Link from "next/link";
3-
import { useRouter } from 'next/router';
3+
import { useRouter } from "next/router";
44

55
/**
66
* @interface SidebarProps
@@ -26,9 +26,7 @@ export default function Sidebar(): JSX.Element {
2626
return router.asPath === link;
2727
};
2828

29-
const scoreboardLink = hasCurrentCommunity
30-
? `/communities/${currentCommunity.slug}/scoreboard`
31-
: "";
29+
const scoreboardLink = hasCurrentCommunity ? `/communities/${currentCommunity.slug}/scoreboard` : "";
3230
const mainLink = hasCurrentCommunity ? `/communities/${currentCommunity.slug}` : "";
3331

3432
return (
@@ -37,18 +35,16 @@ export default function Sidebar(): JSX.Element {
3735
<div className={isActive(mainLink) ? "" : "opacity-80"}>
3836
<div className="font-medium text-.5xl leading-snug">Challenges</div>
3937
<div className="text-sm font-light lg:w-full lg:pr-7 pt-2 mb-6 md:mb-0">
40-
In the courses of this community, you will be able to learn about new
41-
technologies, solve challenges, get feedback, and earn bounties.
38+
In the courses of this community, you will be able to learn about new technologies, solve challenges, get feedback, and earn bounties.
4239
</div>
4340
</div>
4441
</Link>
4542
{hasCurrentCommunity && (
4643
<Link href={scoreboardLink}>
4744
<div className={isActive(scoreboardLink) ? "pt-5" : "opacity-80 md:block hidden scroll-smooth pt-5"}>
4845
<div className="font-medium text-.5xl leading-snug">Scoreboard</div>
49-
<div className="text-sm font-light lg:w-full lg:pr-7 pt-2">
50-
On the scoreboard, you can see which users have accumulated the most
51-
reputation by giving valuable feedback to their peers.
46+
<div className="text-sm font-light lg:w-full lg:pr-7 pt-2 mb-6 md:mb-0">
47+
On the scoreboard, you can see which users have accumulated the most reputation by giving valuable feedback to their peers.
5248
</div>
5349
</div>
5450
</Link>

src/pages/communities/[slug]/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { wrapper } from "@/store";
1010
import { fetchCurrentCommunity } from "@/store/services/community.service";
1111
import { fetchAllChallenges } from "@/store/services/communities/challenges";
1212
import { NotFoundError } from "@/utilities/errors/NotFoundError";
13+
import { fetchAllScoreboards } from "@/store/services/communities/scoreboard.service";
1314
export default function Slug(props: {
1415
pageProps: {
1516
community: Community;
@@ -43,16 +44,18 @@ export const getServerSideProps = wrapper.getServerSideProps((store) => async ({
4344
try {
4445
const slug = params?.slug as string;
4546

46-
const [{ data: community }, { data: challenges }, translations] = await Promise.all([
47+
const [{ data: community }, { data: challenges }, { data: scoreboards }, translations] = await Promise.all([
4748
store.dispatch(fetchCurrentCommunity({ slug, locale })),
4849
store.dispatch(fetchAllChallenges({ slug })),
50+
store.dispatch(fetchAllScoreboards({ slug, locale: locale || "en" })),
4951
serverSideTranslations(locale as string),
5052
]);
51-
if (!community || !challenges) throw new NotFoundError();
53+
if (!community || !challenges || !scoreboards) throw new NotFoundError();
5254
return {
5355
props: {
5456
community,
5557
challenges,
58+
scoreboards,
5659
...translations,
5760
},
5861
};

src/store/services/communities/scoreboard.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const scoreboardService = createApi({
3737
} catch (err) {
3838
console.error(err);
3939
} finally {
40-
setLoading(false);
40+
dispatch(setLoading(false));
4141
}
4242
},
4343
}),

0 commit comments

Comments
 (0)