feat(submissions): Implement submissions page with paginated table
This commit introduces a new page for users to view their submissions in a structured and paginated table. This allows users to easily track their submission history and access key details. The main changes include: - A new page at `/submissions` to display the submissions list. - A `SubmissionsTable` component to render submission data, including title, country, status, and a link to the submission URL. - Integration of `react-paginate` to handle navigation through large sets of data. - A new `useSubmissions` custom hook using TanStack Query for efficient, paginated data fetching from the API. - Addition of the `currency-symbol-map` dependency to display prices with the correct currency symbol.
This commit is contained in:
+26
-1
@@ -1,7 +1,12 @@
|
||||
import * as moment from "moment";
|
||||
export const unixToDate = (unix: number) => {
|
||||
return moment.unix(unix).format("DD-MM-YYYY");
|
||||
return moment.unix(unix).format("YYYY/MM/DD");
|
||||
};
|
||||
export const msToDate = (ms: number) => {
|
||||
return moment.default(ms).format("YYYY/MM/DD");
|
||||
};
|
||||
|
||||
|
||||
export const getStatusColor = <T>(status: T) => {
|
||||
switch (status) {
|
||||
case "active":
|
||||
@@ -16,3 +21,23 @@ export const getStatusColor = <T>(status: T) => {
|
||||
return "bg-gray-3";
|
||||
}
|
||||
};
|
||||
export const formatPhoneNumber = (input?: string) => {
|
||||
if (!input) return "";
|
||||
|
||||
let cleaned = input.replace(/[^\d+]/g, "");
|
||||
|
||||
const hasPlus = cleaned.startsWith("+");
|
||||
if (hasPlus) {
|
||||
cleaned = cleaned.slice(1);
|
||||
}
|
||||
|
||||
const groups = [];
|
||||
let i = 0;
|
||||
while (i < cleaned.length) {
|
||||
const size = i === 0 ? 3 : 4;
|
||||
groups.push(cleaned.slice(i, i + size));
|
||||
i += size;
|
||||
}
|
||||
|
||||
return (hasPlus ? "+" : "") + groups.join(" ");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user