Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions src/common/components/profile-activities/activities-dropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import React, { useState } from 'react'
import DropDown from "../dropdown"
import { ActivitiesGroup } from "./types/activities-group"

interface Props {
setFilter: React.Dispatch<React.SetStateAction<"" | ActivitiesGroup>>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just means setFilter: (v: string) => void

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just means setFilter: (v: string) => void

thanks, I'll handle that

}

const ActivitiesDropdown = (props: Props) => {

const { setFilter } = props;

const [label, setLabel] = useState("")

const dropDown = (
<div className="mb-2">
<div>
{(() => {
let dropDownConfig: any;
dropDownConfig = {
history: "",
label: label ? label : "All",
items: [
{
label: <span>All</span>,
onClick: () => {
setLabel("All");
setFilter("");
}
},
{
label: <span>Comments</span>,
onClick: () => {
setLabel("Comments");
setFilter("comment");
}
},
{
label: <span>Replies</span>,
onClick: () => {
setLabel("Replies");
setFilter("comment");
}
},
{
label: <span>Custom json</span>,
onClick: () => {
setLabel("Follows");
setFilter("custom_json");
}
},
// {
// label: <span>Likes</span>,
// onClick: () => {
// setLabel("Likes");
// setFilter("custom_json");
// }
// },
// {
// label: <span>Communities</span>,
// onClick: () => {
// setLabel("Communities");
// setFilter("custom_json");
// }
// },
{
label: <span>Witness votes</span>,
onClick: () => {
setLabel("Witness votes");
setFilter("account_witness_vote");
}
},
{
label: <span>Proposal votes</span>,
onClick: () => {
setLabel("Proposal votes");
setFilter("update_proposal_votes");
}
}
]
};
return (
<div className="dropdown-wrapper">
<DropDown {...dropDownConfig} float="top" />
</div>
);
})()}
</div>
</div>
);

return (
<>
<div className="dropdown-header">
<h5>Filter activities</h5>
</div>
{dropDown}
</>
)
}

export default ActivitiesDropdown
35 changes: 35 additions & 0 deletions src/common/components/profile-activities/activities-types.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react'
import { Link } from 'react-router-dom'
import { Account } from "../../store/accounts/types"
import { Global } from '../../store/global/types'

interface Props {
account: Account;
global: Global;
}

const ActivitiesTypes = (props: Props) => {

const { account, global } = props;
return (
<div>
<div className="d-flex justify-content-center">
<h5 className="types-header">Activity Types</h5>
</div>
<div className={`types-wrapper`}>
<div className={`${global.isMobile ? "flex-row" : "flex-column"} filter-types`}>
<Link to={`/@${account?.name}/comments`}>Comments</Link>
<Link to={`/@${account?.name}/replies`}>Replies</Link>
<Link to={`/@${account?.name}/trail`}>Votes</Link>
<Link to={`/@${account?.name}/communities`}>Communities</Link>
</div>
<div className={`${global.isMobile ? "flex-row" : "flex-column"} filter-types`}>
<Link to={`/witnesses?voter=${account.name}`}>Witness votes</Link>
<Link to={`/proposals?voter=${account.name}`}>Proposal votes</Link>
</div>
</div>
</div>
)
}

export default ActivitiesTypes
Loading