Skip to content

Commit

Permalink
added redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalikKarpuk committed Jul 9, 2024
1 parent d6c5f02 commit 280450a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const activitiesConfig: TableConfig[] = [
{
colName: "DomainName",
headerText: "Domain Name",
columnTemplate: TableTemplates.STRING,
columnTemplate: TableTemplates.LINK,
fields: {
value: "domainName",
link: 'domainNameRedirect'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ const ActivityContent = (): JSX.Element => {
content: response?.content?.map((item) => {
return {
...item,
domainNameRedirect: `${Routs.NAME}/${item.id}`,
redirectLink: `https://minascan.io/${chain}/tx/${item.transaction}`,
domainNameRedirect: `${Routs.NAME}/${item.domainId}`,
...(item.transaction
? {
redirectLink: `https://minascan.io/${chain}/tx/${item.transaction}`,
}
: []),
domainName: addMinaText(item?.domainName),
};
}),
Expand All @@ -60,6 +64,7 @@ const ActivityContent = (): JSX.Element => {
const onPage = (page) => {
setPage(page);
};
console.log(activities);

return (
<Table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const ActivityContent = ({
content: response?.content?.map((item) => {
return {
...item,
domainNameRedirect: `${Routs.NAME}/${item.id}`,
redirectLink: `https://minascan.io/${chain}/tx/${item.transaction}`,
domainName: addMinaText(item?.domainName),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ import { FC } from "react";

import style from "./index.module.css";
import TruncateText from "@/components/molecules/truncateText";
import StringTemplate from "../stringTemplate";
import { TableConfig } from "@/comman/types";

type LinkTemplateProps = {
data: any;
config: {
fields: {
link: string;
value: string;
};
};
config: TableConfig;
};
const LinkTemplate: FC<LinkTemplateProps> = ({ data, config }) => {
const LinkTemplate: FC<LinkTemplateProps> = (props) => {
const { data, config } = props;
const link = data[config.fields.link];
const value = data[config.fields.value];

if (value && !link) {
return <StringTemplate {...props}/>;
}

return (
<>
{link && value ? (
Expand Down

0 comments on commit 280450a

Please sign in to comment.