Skip to content

Commit

Permalink
Merge pull request #514 from IntersectMBO/feat/change-route-name
Browse files Browse the repository at this point in the history
feat: Changed naming of latest updates to voting updates
  • Loading branch information
MGukic authored Dec 19, 2024
2 parents 4bd22fb + 57ffa44 commit 5fd1190
Show file tree
Hide file tree
Showing 14 changed files with 133 additions and 133 deletions.
6 changes: 3 additions & 3 deletions frontend/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"addNewMember": "Add new member",
"card": {
"joined": "Joined",
"latestUpdates": "Voting updates"
"votingUpdates": "Voting updates"
}
},
"LatestUpdates": {
"VotingUpdates": {
"title": "Voting Updates",
"govAction": "Governance Action",
"govActionCategoryShort": "GA Category",
Expand Down Expand Up @@ -285,7 +285,7 @@
"title": "No members found",
"description": "There are currently no members. Please check back later for updates"
},
"latestUpdates": {
"votingUpdates": {
"title": "No votes found",
"description": "There are currently no votes. Please check back later for updates"
},
Expand Down
6 changes: 3 additions & 3 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"addNewMember": "Add new member",
"card": {
"joined": "Joined",
"latestUpdates": "Voting updates"
"votingUpdates": "Voting updates"
}
},
"LatestUpdates": {
"VotingUpdates": {
"title": "Voting Updates",
"govAction": "Governance Action",
"govActionCategoryShort": "GA Category",
Expand Down Expand Up @@ -285,7 +285,7 @@
"title": "No members found",
"description": "There are currently no members. Please check back later for updates"
},
"latestUpdates": {
"votingUpdates": {
"title": "No votes found",
"description": "There are currently no votes. Please check back later for updates"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import React, { Suspense } from "react";

import { unstable_setRequestLocale } from "next-intl/server"; // Import function to set the request-specific locale (unstable API).
import { Footer, LatestUpdates, NotFound, TopNav } from "@organisms";
import { Footer, VotingUpdates, NotFound, TopNav } from "@organisms";
import { Loading } from "@molecules";
import { getLatestUpdates } from "@/lib/api";
import { getVotingUpdates } from "@/lib/api";
import { isEmpty, isResponseErrorI } from "@utils";
import { ContentWrapper } from "@atoms";

export default async function LatestUpdatesPage({
export default async function VotingUpdatesPage({
params: { locale },
searchParams,
}) {
unstable_setRequestLocale(locale); // Sets the locale for the request. Use cautiously due to its unstable nature.
const latestUpdates = await getLatestUpdates({
const votingUpdates = await getVotingUpdates({
search: searchParams?.search,
govActionType: searchParams?.govActionType,
vote: searchParams?.vote,
sortBy: searchParams?.sortBy,
});
const hasError = isResponseErrorI(latestUpdates);
const hasError = isResponseErrorI(votingUpdates);
return (
<>
<TopNav />
<ContentWrapper>
<Suspense fallback={<Loading />}>
{(isEmpty(latestUpdates) || hasError) && isEmpty(searchParams) ? (
{(isEmpty(votingUpdates) || hasError) && isEmpty(searchParams) ? (
<NotFound
title="latestUpdates.title"
description="latestUpdates.description"
title="votingUpdates.title"
description="votingUpdates.description"
/>
) : (
<LatestUpdates
latestUpdates={!hasError && latestUpdates?.data}
paginationMeta={!hasError && latestUpdates?.meta}
error={hasError && latestUpdates.error}
<VotingUpdates
votingUpdates={!hasError && votingUpdates?.data}
paginationMeta={!hasError && votingUpdates?.meta}
error={hasError && votingUpdates.error}
/>
)}
</Suspense>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const MembersCard = ({
data-testid={`members-${id}-latest-updates`}
endIcon={<img src={ICONS.arrowUpRight} />}
>
{t("card.latestUpdates")}
{t("card.votingUpdates")}
</Button>
*/}
</Box>
Expand Down
20 changes: 10 additions & 10 deletions frontend/src/components/organisms/MyActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { useModal } from "@/context";
import { getUserVotes } from "@/lib/api";
import { PaginationMeta, VotesTableI } from "@/lib/requests";
import {
LATEST_UPDATES_FILTERS,
LATEST_UPDATES_SORTING,
VOTING_UPDATES_FILTERS,
VOTING_UPDATES_SORTING,
MY_ACTIONS_TABS,
PATHS
PATHS,
} from "@consts";
import { useManageQueryParams, usePagination } from "@hooks";
import { Box } from "@mui/material";
Expand All @@ -26,7 +26,7 @@ export const MyActions = ({
actions,
paginationMeta,
error,
userId
userId,
}: {
actions: VotesTableI[];
paginationMeta: PaginationMeta;
Expand Down Expand Up @@ -59,9 +59,9 @@ export const MyActions = ({
reasoning_title: action.reasoning_title,
rationale_url: action.rationale_url,
status: action.gov_action_proposal_status,
title: action.gov_action_proposal_title
}
}
title: action.gov_action_proposal_title,
},
},
});
};
const params: Record<string, string | null> = {
Expand All @@ -72,7 +72,7 @@ export const MyActions = ({
: null,
vote: chosenFilters.vote?.length > 0 ? chosenFilters.vote?.join(",") : null,
sortBy: chosenSorting || null,
userId
userId,
};

const { data, pagination, isLoading, loadMore } = usePagination(
Expand Down Expand Up @@ -124,8 +124,8 @@ export const MyActions = ({
setSortOpen={setSortOpen}
sortingActive={Boolean(chosenSorting)}
sortOpen={sortOpen}
sortOptions={LATEST_UPDATES_SORTING}
filterOptions={LATEST_UPDATES_FILTERS}
sortOptions={VOTING_UPDATES_SORTING}
filterOptions={VOTING_UPDATES_FILTERS}
/>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export const VotesTableRow = ({
votes,
disabled,
actionTitle,
onActionClick
onActionClick,
}: Props) => {
const t = useTranslations("LatestUpdates");
const t = useTranslations("VotingUpdates");
const {
user_name,
user_address,
Expand All @@ -30,7 +30,7 @@ export const VotesTableRow = ({
rationale_url,
gov_action_proposal_title,
gov_action_proposal_type,
vote_submit_time
vote_submit_time,
} = votes;

return (
Expand All @@ -41,7 +41,7 @@ export const VotesTableRow = ({
display: "flex",
flexDirection: { xxs: "column", md: "row" },
gap: { xxs: 3, md: 0 },
width: "100%"
width: "100%",
}}
>
<Grid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client";

import { useModal } from "@/context";
import { getLatestUpdates } from "@/lib/api";
import { getVotingUpdates } from "@/lib/api";
import { PaginationMeta, VotesTableI } from "@/lib/requests";
import { ShowMoreButton, Typography } from "@atoms";
import { LATEST_UPDATES_FILTERS, LATEST_UPDATES_SORTING } from "@consts";
import { VOTING_UPDATES_FILTERS, VOTING_UPDATES_SORTING } from "@consts";
import { useManageQueryParams, usePagination } from "@hooks";
import { Box } from "@mui/material";
import { countSelectedFilters, isEmpty } from "@utils";
Expand All @@ -15,16 +15,16 @@ import { NotFound } from "./NotFound";
import { OpenPreviewReasoningModal } from "./types";
import { VotesTable } from "./VotesTable";

export const LatestUpdates = ({
latestUpdates,
export const VotingUpdates = ({
votingUpdates,
paginationMeta,
error
error,
}: {
latestUpdates: VotesTableI[];
votingUpdates: VotesTableI[];
paginationMeta: PaginationMeta;
error?: string;
}) => {
const t = useTranslations("LatestUpdates");
const t = useTranslations("VotingUpdates");
const { updateQueryParams } = useManageQueryParams();
const [searchText, setSearchText] = useState<string>("");
const [filtersOpen, setFiltersOpen] = useState(false);
Expand All @@ -49,9 +49,9 @@ export const LatestUpdates = ({
reasoning_title: action.reasoning_title,
rationale_url: action.rationale_url,
status: action.gov_action_proposal_status,
title: action.gov_action_proposal_title
}
}
title: action.gov_action_proposal_title,
},
},
});
};

Expand All @@ -62,13 +62,13 @@ export const LatestUpdates = ({
? chosenFilters.govActionType?.join(",")
: null,
vote: chosenFilters.vote?.length > 0 ? chosenFilters.vote?.join(",") : null,
sortBy: chosenSorting || null
sortBy: chosenSorting || null,
};

const { data, pagination, isLoading, loadMore } = usePagination(
latestUpdates,
votingUpdates,
paginationMeta,
(page) => getLatestUpdates({ page, ...params })
(page) => getVotingUpdates({ page, ...params })
);

const closeFilters = useCallback(() => {
Expand Down Expand Up @@ -108,16 +108,16 @@ export const LatestUpdates = ({
setSortOpen={setSortOpen}
sortingActive={Boolean(chosenSorting)}
sortOpen={sortOpen}
sortOptions={LATEST_UPDATES_SORTING}
filterOptions={LATEST_UPDATES_FILTERS}
sortOptions={VOTING_UPDATES_SORTING}
filterOptions={VOTING_UPDATES_FILTERS}
/>
</Box>
</Box>
{isEmpty(data) || error ? (
<NotFound
height="50vh"
title="latestUpdates.title"
description="latestUpdates.description"
title="votingUpdates.title"
description="votingUpdates.description"
/>
) : (
<Box display="flex" flexDirection="column" gap={4}>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/organisms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export * from "./Constitution";
export * from "./MembersCard";
export * from "./Tabs";
export * from "./VotesTable";
export * from "./LatestUpdates";
export * from "./VotingUpdates";
export * from "./MyActions";
export * from "./PageTitleTabs";
export * from "./GovernanceActions";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/constants/governanceAction/filters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FilterItems } from "@molecules";

export const LATEST_UPDATES_FILTERS: Record<string, FilterItems> = {
export const VOTING_UPDATES_FILTERS: Record<string, FilterItems> = {
govActionType: {
key: "govActionType",
title: "Governance Action Type",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/constants/governanceAction/sorting.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FilterItem } from "@molecules";

export const LATEST_UPDATES_SORTING: FilterItem[] = [
export const VOTING_UPDATES_SORTING: FilterItem[] = [
{
key: "submitTime:ASC",
label: "Newest first",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/constants/navItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const NAV_ITEMS = [
newTabLink: null,
},
{
dataTestId: "latestUpdates",
href: PATHS.latestUpdates,
dataTestId: "votingUpdates",
href: PATHS.votingUpdates,
label: "Voting Updates",
newTabLink: null,
},
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/constants/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ export const PATHS = {
constitution: "/interim-constitution",
versionHistory: "/interim-constitution/version-history",
members: "/members",
latestUpdates: "/latest-updates",
votingUpdates: "/voting-updates",
myActions: "/my-actions",
governanceActions: "/governance-actions",
logout: "/logout",
admin: {
home: "/admin",
dashboard: "/admin/dashboard"
}
dashboard: "/admin/dashboard",
},
};

export const EXTERNAL_LINKS = {
Expand All @@ -23,7 +23,7 @@ export const EXTERNAL_LINKS = {
guardrailsScript:
"https://github.com/IntersectMBO/plutus/tree/master/cardano-constitution",
guardrailsRationale:
"https://docs.google.com/document/d/1FDVnDwugtA5RlgH8a-_8pWL_W-VGvMYA"
"https://docs.google.com/document/d/1FDVnDwugtA5RlgH8a-_8pWL_W-VGvMYA",
};

export const adminProtectedPath = PATHS.admin.dashboard;
Expand Down
Loading

0 comments on commit 5fd1190

Please sign in to comment.