diff --git a/docker-compose.yaml b/docker-compose.yaml index b734574e..356d5fdb 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -39,7 +39,7 @@ services: - "5001:5001" - "8080:8080" volumes: - - ipfs_data:/ipfs/datastore + - ipfs_data:/app/ipfs/ networks: - bloxico_local extra_hosts: diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 806a85d7..73ff2523 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -27,11 +27,11 @@ "addNewMember": "Add new member", "card": { "joined": "Joined", - "latestUpdates": "Latest updates" + "votingUpdates": "Voting updates" } }, - "LatestUpdates": { - "title": "Latest Updates", + "VotingUpdates": { + "title": "Voting Updates", "govAction": "Governance Action", "govActionCategoryShort": "GA Category", "voted": "Voted", @@ -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" }, diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 0977eae0..29af5ef2 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -27,11 +27,11 @@ "addNewMember": "Add new member", "card": { "joined": "Joined", - "latestUpdates": "Latest updates" + "votingUpdates": "Voting updates" } }, - "LatestUpdates": { - "title": "Latest Updates", + "VotingUpdates": { + "title": "Voting Updates", "govAction": "Governance Action", "govActionCategoryShort": "GA Category", "voted": "Voted", @@ -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" }, diff --git a/frontend/src/app/[locale]/latest-updates/page.tsx b/frontend/src/app/[locale]/voting-updates/page.tsx similarity index 58% rename from frontend/src/app/[locale]/latest-updates/page.tsx rename to frontend/src/app/[locale]/voting-updates/page.tsx index 2e5bdd4d..e5dde62d 100644 --- a/frontend/src/app/[locale]/latest-updates/page.tsx +++ b/frontend/src/app/[locale]/voting-updates/page.tsx @@ -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 ( <> }> - {(isEmpty(latestUpdates) || hasError) && isEmpty(searchParams) ? ( + {(isEmpty(votingUpdates) || hasError) && isEmpty(searchParams) ? ( ) : ( - )} diff --git a/frontend/src/components/organisms/Constitution/Constitution.tsx b/frontend/src/components/organisms/Constitution/Constitution.tsx index dbc38796..cfbfa539 100644 --- a/frontend/src/components/organisms/Constitution/Constitution.tsx +++ b/frontend/src/components/organisms/Constitution/Constitution.tsx @@ -1,6 +1,6 @@ "use client"; -import { ContentWrapper, Typography } from "@/components/atoms"; +import { Button, ContentWrapper, Typography } from "@/components/atoms"; import { customPalette, IMAGES } from "@consts"; import { useScreenDimension } from "@hooks"; import { Box, Grid, IconButton } from "@mui/material"; @@ -20,16 +20,21 @@ import { ListItem, NavDrawerDesktop, Paragraph, - TABLE_OF_CONTENTS_WRAPPER_STYLE_PROPS + TABLE_OF_CONTENTS_WRAPPER_STYLE_PROPS, } from "./MDXComponents"; import { TocAccordion } from "./TOCAccordion"; import TOCLink from "./TOCLink"; +import PermissionChecker from "../PermissionChecker"; +import { useAppContext, useModal } from "@/context"; export function Constitution({ constitution, metadata }: ConstitutionProps) { const { screenWidth } = useScreenDimension(); const [isOpen, setIsOpen] = useState(false); const isMobile = screenWidth < 1025; const t = useTranslations("Constitution"); + const { userSession } = useAppContext(); + const { openModal } = useModal(); + const uploadConstitution = () => openModal({ type: "uploadConstitution" }); const onTOCLinkClick = () => { if (isMobile) { @@ -72,7 +77,7 @@ export function Constitution({ constitution, metadata }: ConstitutionProps) { return ; } return ; - } + }, }; return ( @@ -102,13 +107,27 @@ export function Constitution({ constitution, metadata }: ConstitutionProps) { bgcolor={customPalette.bgWhite} > {t("title")} + + + setIsOpen(true)} sx={{ bgcolor: customPalette.arcticWhite, display: { xxs: "flex", lg: "none" }, - justifyContent: "center" + justifyContent: "center", }} > diff --git a/frontend/src/components/organisms/Constitution/MDXComponents.tsx b/frontend/src/components/organisms/Constitution/MDXComponents.tsx index 3c087002..ba56fe27 100644 --- a/frontend/src/components/organisms/Constitution/MDXComponents.tsx +++ b/frontend/src/components/organisms/Constitution/MDXComponents.tsx @@ -8,7 +8,6 @@ import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { ReactNode } from "react"; -import PermissionChecker from "../PermissionChecker"; const Anchor = ({ id, offset = "-20vh " }) => { return ( @@ -18,7 +17,7 @@ const Anchor = ({ id, offset = "-20vh " }) => { display: "block", position: "relative", top: offset, - visibility: "hidden" + visibility: "hidden", }} /> ); @@ -38,7 +37,7 @@ export const Heading1 = ({ children, id }) => ( marginTop: "24px", marginBottom: "16px", lineHeight: "1.25em", - fontSize: { xxs: 20, md: 32 } + fontSize: { xxs: 20, md: 32 }, }} variant="headline4" > @@ -57,7 +56,7 @@ export const Heading2 = ({ children, id }) => ( fontWeight: 600, fontSize: { xxs: 16, md: 20 }, - lineHeight: "1.25em" + lineHeight: "1.25em", }} > {children} @@ -74,7 +73,7 @@ export const Heading3 = ({ children, id }) => ( marginBottom: "16px", fontWeight: 600, fontSize: { xxs: 14, md: 18 }, - lineHeight: "1.25em" + lineHeight: "1.25em", }} > {children} @@ -91,7 +90,7 @@ export const Heading5 = ({ children }) => ( fontWeight: 800, fontSize: { xxs: 12, md: 14 }, lineHeight: "1em", - overflowWrap: "break-word" + overflowWrap: "break-word", }} > {children} @@ -105,7 +104,7 @@ export const Paragraph = ({ children, id }) => ( lineHeight: "1.5", marginBottom: "16px", fontSize: "14px", - color: customPalette.textGray + color: customPalette.textGray, }} variant="caption" > @@ -124,7 +123,7 @@ export const ListItem = ({ children, id }) => ( flexDirection: "column", alignItems: "flex-start", justifyContent: "center", - wordBreak: "break-all" + wordBreak: "break-all", }} > {children} @@ -140,7 +139,7 @@ export const Code = ({ children }) => ( margin: 0, whiteSpace: "break-spaces", backgroundColor: "#afb8c133", - borderRadius: "6px" + borderRadius: "6px", }} > {children} @@ -152,7 +151,7 @@ export const TABLE_OF_CONTENTS_WRAPPER_STYLE_PROPS = { borderRadius: "16px", padding: "12px", "& ol.toc-level": { - margin: 0 + margin: 0, }, "& ol.toc-level-1": { paddingInlineStart: "20px", @@ -160,12 +159,12 @@ export const TABLE_OF_CONTENTS_WRAPPER_STYLE_PROPS = { "& li": { listStyle: "outside !important", "& a.toc-link-h1": { - fontWeight: 600 - } - } + fontWeight: 600, + }, + }, }, "& ol.toc-level-2": { - margin: "10px 0px 10px 0px" + margin: "10px 0px 10px 0px", }, "& li": { width: "100%", @@ -176,9 +175,9 @@ export const TABLE_OF_CONTENTS_WRAPPER_STYLE_PROPS = { fontSize: "1rem", fontWeight: 400, lineHeight: "56px", - color: customPalette.textBlack - } - } + color: customPalette.textBlack, + }, + }, }; export const DrawerNav = () => { const t = useTranslations("Constitution"); @@ -193,26 +192,9 @@ export const DrawerNav = () => { const buttonEndIcon = pathname.includes(PATHS.versionHistory) ? ICONS.arrowLeft : ICONS.documentSearch; - const { openModal } = useModal(); - const { userSession } = useAppContext(); - const uploadConstitution = () => openModal({ type: "uploadConstitution" }); - return ( - - - - + return ( + */} diff --git a/frontend/src/components/organisms/MyActions.tsx b/frontend/src/components/organisms/MyActions.tsx index d957e4b2..4ea4c15a 100644 --- a/frontend/src/components/organisms/MyActions.tsx +++ b/frontend/src/components/organisms/MyActions.tsx @@ -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"; @@ -26,7 +26,7 @@ export const MyActions = ({ actions, paginationMeta, error, - userId + userId, }: { actions: VotesTableI[]; paginationMeta: PaginationMeta; @@ -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 = { @@ -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( @@ -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} /> diff --git a/frontend/src/components/organisms/UsersList/UsersList.tsx b/frontend/src/components/organisms/UsersList/UsersList.tsx index 54dcc4b9..68b764c3 100644 --- a/frontend/src/components/organisms/UsersList/UsersList.tsx +++ b/frontend/src/components/organisms/UsersList/UsersList.tsx @@ -19,7 +19,7 @@ import { UsersListItem } from "./UsersListItem"; export function UsersList({ usersList, paginationMeta, - error + error, }: { usersList: UserListItem[]; paginationMeta: PaginationMeta; @@ -31,7 +31,7 @@ export function UsersList({ const { addErrorAlert } = useSnackbar(); const params: Record = { search: searchText || null, - sortBy: chosenSorting || null + sortBy: chosenSorting || null, }; const { data, pagination, isLoading, loadMore } = usePagination( usersList, @@ -44,7 +44,7 @@ export function UsersList({ const { openModal } = useModal(); const addMember = () => openModal({ - type: "addMember" + type: "addMember", }); useEffect(() => { @@ -73,14 +73,8 @@ export function UsersList({ alignItems={{ xxs: "left", md: "center" }} gap={3} > - {t("title")} - + + {t("title")} - + {isEmpty(data) || error ? ( { - const t = useTranslations("LatestUpdates"); + const t = useTranslations("VotingUpdates"); const { user_name, user_address, @@ -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 ( @@ -41,7 +41,7 @@ export const VotesTableRow = ({ display: "flex", flexDirection: { xxs: "column", md: "row" }, gap: { xxs: 3, md: 0 }, - width: "100%" + width: "100%", }} > { - const t = useTranslations("LatestUpdates"); + const t = useTranslations("VotingUpdates"); const { updateQueryParams } = useManageQueryParams(); const [searchText, setSearchText] = useState(""); const [filtersOpen, setFiltersOpen] = useState(false); @@ -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, + }, + }, }); }; @@ -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(() => { @@ -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} /> {isEmpty(data) || error ? ( ) : ( diff --git a/frontend/src/components/organisms/index.ts b/frontend/src/components/organisms/index.ts index 28fa1b82..aba61dfb 100644 --- a/frontend/src/components/organisms/index.ts +++ b/frontend/src/components/organisms/index.ts @@ -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"; diff --git a/frontend/src/constants/governanceAction/filters.ts b/frontend/src/constants/governanceAction/filters.ts index 07d8badc..26002b82 100644 --- a/frontend/src/constants/governanceAction/filters.ts +++ b/frontend/src/constants/governanceAction/filters.ts @@ -1,6 +1,6 @@ import { FilterItems } from "@molecules"; -export const LATEST_UPDATES_FILTERS: Record = { +export const VOTING_UPDATES_FILTERS: Record = { govActionType: { key: "govActionType", title: "Governance Action Type", diff --git a/frontend/src/constants/governanceAction/sorting.ts b/frontend/src/constants/governanceAction/sorting.ts index 169c40be..6044e9cd 100644 --- a/frontend/src/constants/governanceAction/sorting.ts +++ b/frontend/src/constants/governanceAction/sorting.ts @@ -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", diff --git a/frontend/src/constants/navItems.ts b/frontend/src/constants/navItems.ts index abf2b283..e1fec9d1 100644 --- a/frontend/src/constants/navItems.ts +++ b/frontend/src/constants/navItems.ts @@ -14,9 +14,9 @@ export const NAV_ITEMS = [ newTabLink: null, }, { - dataTestId: "latestUpdates", - href: PATHS.latestUpdates, - label: "Latest Updates", + dataTestId: "votingUpdates", + href: PATHS.votingUpdates, + label: "Voting Updates", newTabLink: null, }, ]; diff --git a/frontend/src/constants/paths.ts b/frontend/src/constants/paths.ts index 53cc18c1..17fc43af 100644 --- a/frontend/src/constants/paths.ts +++ b/frontend/src/constants/paths.ts @@ -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 = { @@ -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; diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 59de7714..c6ad95ef 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -3,7 +3,7 @@ import { ConstitutionByCid, ConstitutionMetadata, - GovActionMetadata + GovActionMetadata, } from "@organisms"; import { getAccessToken, isEmpty, setAuthCookies } from "@utils"; import jwt from "jsonwebtoken"; @@ -21,7 +21,7 @@ import { ReasoningResponseI, ResponseErrorI, UserAuthStatus, - VotesTableI + VotesTableI, } from "./requests"; import { getTranslations } from "next-intl/server"; @@ -114,14 +114,14 @@ export async function login( ): Promise { try { const res: LoginResponse = await axiosInstance.post("/api/auth/login", { - destination: email + destination: email, }); return res; } catch (error) { const t = await getTranslations(); return { error: t("Modals.signIn.alerts.error"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -138,7 +138,7 @@ export async function loginAuthCallback(token: string) { const t = await getTranslations(); return { error: t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -155,7 +155,7 @@ export async function registerAuthCallback(token: string) { const t = await getTranslations(); return { error: t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -166,8 +166,8 @@ export async function refreshToken(refresh_token: string) { method: "POST", body: JSON.stringify({ refresh_token }), headers: { - "Content-Type": "application/json" - } + "Content-Type": "application/json", + }, }); const responseData = await res.json(); @@ -189,7 +189,7 @@ export async function getUser( error.res?.statusCode === 401 && t(`General.errors.sessionExpired`); return { error: customErrorMessage || t(`General.errors.somethingWentWrong`), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -205,12 +205,12 @@ export async function toggleUserStatus( `/api/users/${decodedToken?.userId}/toggle-status`, { user_id, - status + status, }, { headers: { - Authorization: `Bearer ${token}` - } + Authorization: `Bearer ${token}`, + }, } ); return res; @@ -222,7 +222,7 @@ export async function toggleUserStatus( t(`General.errors.sessionExpired`); return { error: customErrorMessage || t("Modals.deleteRole.alerts.error"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -231,7 +231,7 @@ export async function getUsersAdmin({ search, sortBy, page = 1, - limit = DEFAULT_PAGINATION_LIMIT + limit = DEFAULT_PAGINATION_LIMIT, }: { search?: string; sortBy?: string; @@ -247,14 +247,14 @@ export async function getUsersAdmin({ search, sortBy, page, - limit + limit, } ); const res: { data: FetchUserData[]; meta: PaginationMeta } = await axiosInstance.get(path, { headers: { - Authorization: `bearer ${token}` - } + Authorization: `bearer ${token}`, + }, }); return res; } catch (error) { @@ -265,7 +265,7 @@ export async function getUsersAdmin({ t(`General.errors.sessionExpired`); return { error: customErrorMessage || t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -274,7 +274,7 @@ export async function getMembers({ search, sortBy, page = 1, - limit = DEFAULT_PAGINATION_LIMIT + limit = DEFAULT_PAGINATION_LIMIT, }: { search?: string; sortBy?: string; @@ -286,7 +286,7 @@ export async function getMembers({ search, sortBy, page, - limit + limit, }); const res: { data: FetchUserData[]; meta: PaginationMeta } = await axiosInstance.get(path); @@ -295,18 +295,18 @@ export async function getMembers({ const t = await getTranslations(); return { error: t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } -export async function getLatestUpdates({ +export async function getVotingUpdates({ page = 1, limit = DEFAULT_PAGINATION_LIMIT, search, govActionType, vote, - sortBy + sortBy, }: { page?: number; limit?: number; @@ -323,7 +323,7 @@ export async function getLatestUpdates({ sortBy, "filter.govActionProposal.govActionType": govActionType && `$in:${govActionType}`, - "filter.vote": vote && `$in:${vote}` + "filter.vote": vote && `$in:${vote}`, }); const res: { data: VotesTableI[]; meta: PaginationMeta } = await axiosInstance.get(path); @@ -333,7 +333,7 @@ export async function getLatestUpdates({ const t = await getTranslations(); return { error: t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -345,7 +345,7 @@ export async function getUserVotes({ govActionType, vote, sortBy, - userId + userId, }: { page?: number; limit?: number; @@ -364,7 +364,7 @@ export async function getUserVotes({ "filter.govActionProposal.govActionType": govActionType && `$in:${govActionType}`, "filter.vote": vote && `$in:${vote}`, - "filter.userId": `$eq:${userId}` + "filter.userId": `$eq:${userId}`, }); const res: { data: VotesTableI[]; meta: PaginationMeta } = await axiosInstance.get(path); @@ -373,7 +373,7 @@ export async function getUserVotes({ const t = await getTranslations(); return { error: t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -390,7 +390,7 @@ export async function getGovernanceMetadata( const t = await getTranslations(); return { error: t("Modals.govActionModal.alerts.error"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -401,7 +401,7 @@ export async function getGovernanceActions({ search, govActionType, status, - sortBy + sortBy, }: { page?: number; limit?: number; @@ -422,14 +422,14 @@ export async function getGovernanceActions({ search, sortBy, "filter.govActionType": govActionType && `$in:${govActionType}`, - "filter.status": status && `$in:${status}` + "filter.status": status && `$in:${status}`, } ); const res: { data: GovernanceActionTableI[]; meta: PaginationMeta } = await axiosInstance.get(path, { headers: { - Authorization: `bearer ${token}` - } + Authorization: `bearer ${token}`, + }, }); return res; @@ -441,7 +441,7 @@ export async function getGovernanceActions({ t(`General.errors.sessionExpired`); return { error: customErrorMessage || t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -458,8 +458,8 @@ export async function addOrUpdateReasoning({ data, { headers: { - Authorization: `bearer ${token}` - } + Authorization: `bearer ${token}`, + }, } ); return response; @@ -471,7 +471,7 @@ export async function addOrUpdateReasoning({ t(`General.errors.sessionExpired`); return { error: customErrorMessage || t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -486,8 +486,8 @@ export async function getReasoningData( `/api/governance/users/${user?.userId}/proposals/${proposalId}/rationale`, { headers: { - Authorization: `bearer ${token}` - } + Authorization: `bearer ${token}`, + }, } ); @@ -496,7 +496,7 @@ export async function getReasoningData( const t = await getTranslations(); return { error: t("Modals.previewRationale.alerts.error"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -508,12 +508,12 @@ export async function registerUser(email: string) { const res = await axiosInstance.post( "/api/auth/register-user", { - destination: email + destination: email, }, { headers: { - Authorization: `bearer ${token}` - } + Authorization: `bearer ${token}`, + }, } ); return res; @@ -525,7 +525,7 @@ export async function registerUser(email: string) { t(`General.errors.sessionExpired`); return { error: customErrorMessage || t("Modals.addMember.alerts.error"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -538,12 +538,12 @@ export async function registerAdmin(email: string, permissions: Permissions[]) { "/api/auth/register-admin", { destination: email, - permissions + permissions, }, { headers: { - Authorization: `bearer ${token}` - } + Authorization: `bearer ${token}`, + }, } ); return res; @@ -555,7 +555,7 @@ export async function registerAdmin(email: string, permissions: Permissions[]) { t(`General.errors.sessionExpired`); return { error: customErrorMessage || t("Modals.addMember.alerts.error"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -571,8 +571,8 @@ export async function editUser( data, { headers: { - Authorization: `Bearer ${token}` - } + Authorization: `Bearer ${token}`, + }, } ); return response; @@ -584,7 +584,7 @@ export async function editUser( t(`General.errors.sessionExpired`); return { error: customErrorMessage || t("Modals.signUp.alerts.error"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -601,7 +601,7 @@ export async function getConstitutionMetadata(): Promise< const t = await getTranslations(); return { error: t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -618,7 +618,7 @@ export async function getConstitutionByCid( const t = await getTranslations(); return { error: t("General.errors.somethingWentWrong"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -629,8 +629,8 @@ export async function uploadConstitution(data: FormData) { try { const response = await axiosInstance.post("/api/constitution", data, { headers: { - Authorization: `Bearer ${token}` - } + Authorization: `Bearer ${token}`, + }, }); return response.data; } catch (error) { @@ -644,7 +644,7 @@ export async function uploadConstitution(data: FormData) { return { error: errorMessage, - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -660,8 +660,8 @@ export async function uploadUserPhoto( data, { headers: { - Authorization: `Bearer ${token}` - } + Authorization: `Bearer ${token}`, + }, } ); @@ -675,7 +675,7 @@ export async function uploadUserPhoto( return { error: customErrorMessage || t("Modals.signUp.alerts.errorUploadProfilePhoto"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -686,12 +686,12 @@ export async function resendRegisterEmail(email: string) { const res = await axiosInstance.post( `/api/auth/resend-register-invite`, { - destination: email + destination: email, }, { headers: { - Authorization: `Bearer ${token}` - } + Authorization: `Bearer ${token}`, + }, } ); @@ -700,7 +700,7 @@ export async function resendRegisterEmail(email: string) { const t = await getTranslations(); return { error: t("UsersList.resendAlerts.error"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } @@ -709,18 +709,18 @@ export async function deleteUser(sAdminId: string, userId: string) { try { const res = await axiosInstance.delete(`/api/users/${sAdminId}`, { data: { - user_id: userId + user_id: userId, }, headers: { - Authorization: `Bearer ${token}` - } + Authorization: `Bearer ${token}`, + }, }); return res; } catch (error) { const t = await getTranslations(); return { error: t("Modals.deleteUser.alerts.error"), - statusCode: error.res?.statusCode || null + statusCode: error.res?.statusCode || null, }; } } diff --git a/frontend/src/middleware.ts b/frontend/src/middleware.ts index fc77f545..b582b092 100644 --- a/frontend/src/middleware.ts +++ b/frontend/src/middleware.ts @@ -4,7 +4,7 @@ import { getAuthCookies, isAdminProtectedRoute, isAnyAdminRole, - isUserProtectedRoute + isUserProtectedRoute, } from "@utils"; import * as cookie from "cookie"; import createMiddleware from "next-intl/middleware"; @@ -14,7 +14,7 @@ import { decodeUserToken, isTokenExpired, refreshToken } from "./lib/api"; // Export the middleware configuration to define supported locales and the default locale. const intlMiddleware = createMiddleware({ locales: locales, // Specify the supported locales for the application. - defaultLocale: defaultLocale // Set the default locale to be used when no other locale matches. + defaultLocale: defaultLocale, // Set the default locale to be used when no other locale matches. }); // Define and export a config object to specify which paths the middleware should apply to. @@ -23,7 +23,7 @@ export const config = { matcher: [ "/", "/interim-constitution", - "/latest-updates", + "/voting-updates", "/my-actions", "/governance-actions", "/members", @@ -33,8 +33,8 @@ export const config = { "/(de|en)/:path*", "/((?!api|_next|_vercel|.*\\..*).*)", // However, match all pathnames within `/users`, optionally with a locale prefix - "/([\\w-]+)?/users/(.+)" - ] // Apply middleware to the root path and any path prefixed with supported locales. + "/([\\w-]+)?/users/(.+)", + ], // Apply middleware to the root path and any path prefixed with supported locales. }; export async function middleware(req: NextRequest) { @@ -76,8 +76,8 @@ export async function middleware(req: NextRequest) { // Return updated response with new token const response = NextResponse.next({ request: { - headers: newRequestHeaders - } + headers: newRequestHeaders, + }, }); response.cookies.set("token", newToken?.access_token); response.cookies.set("refresh_token", newToken?.refresh_token);