Skip to content
Snippets Groups Projects
Commit a30c5910 authored by Lukas's avatar Lukas Committed by mcfarhat
Browse files

Add last updated tooltip component to votes and voters dialogs

parent d268d2cb
No related branches found
No related tags found
2 merge requests!481bring recent develop changes to mater to match the backend,!464Lbudginas/#371 adjust last updated status
Pipeline #109042 failed
...@@ -13,10 +13,10 @@ import { ...@@ -13,10 +13,10 @@ import {
TableHeader, TableHeader,
TableRow, TableRow,
} from "@/components/ui/table"; } from "@/components/ui/table";
import { Switch } from "../ui/switch";
import useWitnessDetails from "@/hooks/api/common/useWitnessDetails"; import useWitnessDetails from "@/hooks/api/common/useWitnessDetails";
import CustomPagination from "../CustomPagination"; import CustomPagination from "../CustomPagination";
import { config } from "@/Config"; import { config } from "@/Config";
import LastUpdatedTooltip from "../LastUpdatedTooltip";
type VotersDialogProps = { type VotersDialogProps = {
accountName: string; accountName: string;
...@@ -91,9 +91,11 @@ const VotersDialog: React.FC<VotersDialogProps> = ({ ...@@ -91,9 +91,11 @@ const VotersDialog: React.FC<VotersDialogProps> = ({
<Loader2 className="animate-spin mt-1 h-4 w-4 ml-3 ..." /> <Loader2 className="animate-spin mt-1 h-4 w-4 ml-3 ..." />
)} )}
</div> </div>
<div className="flex justify-between"> <div className="flex justify-end">
{witnessDetails && ( {witnessDetails && (
<p>Last updated : {witnessDetails.votes_updated_at}</p> <LastUpdatedTooltip
lastUpdatedAt={witnessDetails.votes_updated_at}
/>
)} )}
</div> </div>
......
...@@ -22,6 +22,7 @@ import JumpToPage from "../JumpToPage"; ...@@ -22,6 +22,7 @@ import JumpToPage from "../JumpToPage";
import CustomPagination from "../CustomPagination"; import CustomPagination from "../CustomPagination";
import DateTimePicker from "../DateTimePicker"; import DateTimePicker from "../DateTimePicker";
import useWitnessDetails from "@/hooks/api/common/useWitnessDetails"; import useWitnessDetails from "@/hooks/api/common/useWitnessDetails";
import LastUpdatedTooltip from "../LastUpdatedTooltip";
type VotersDialogProps = { type VotersDialogProps = {
accountName: string; accountName: string;
...@@ -84,13 +85,9 @@ const VotesHistoryDialog: React.FC<VotersDialogProps> = ({ ...@@ -84,13 +85,9 @@ const VotesHistoryDialog: React.FC<VotersDialogProps> = ({
onOpenChange={changeVoteHistoryDialogue} onOpenChange={changeVoteHistoryDialogue}
> >
<DialogContent <DialogContent
className={cn( className={cn("h-3/4 max-w-4xl bg-explorer-bg-start", {
"max-w-2xl max-h-[700px] bg-explorer-bg-start overflow-auto", "flex justify-center items-center": !votesHistory,
{ })}
"flex column justify-center items-center": !votesHistory,
"h-3/4": votesHistory?.length >= 16,
}
)}
data-testid="votes-history-dialog" data-testid="votes-history-dialog"
> >
{votesHistory ? ( {votesHistory ? (
...@@ -104,9 +101,11 @@ const VotesHistoryDialog: React.FC<VotersDialogProps> = ({ ...@@ -104,9 +101,11 @@ const VotesHistoryDialog: React.FC<VotersDialogProps> = ({
<Loader2 className="animate-spin mt-1 h-4 w-4 ml-3 ..." /> <Loader2 className="animate-spin mt-1 h-4 w-4 ml-3 ..." />
)} )}
</div> </div>
<div className="flex justify-between"> <div className="flex justify-end">
{witnessDetails && ( {witnessDetails && (
<p>Last updated : {witnessDetails.votes_updated_at}</p> <LastUpdatedTooltip
lastUpdatedAt={witnessDetails.votes_updated_at}
/>
)} )}
</div> </div>
<div className="flex justify-around items-center bg-explorer-bg-start rounded text-text p-2"> <div className="flex justify-around items-center bg-explorer-bg-start rounded text-text p-2">
......
...@@ -25,7 +25,7 @@ import { ...@@ -25,7 +25,7 @@ import {
import VotersDialog from "@/components/Witnesses/VotersDialog"; import VotersDialog from "@/components/Witnesses/VotersDialog";
import VotesHistoryDialog from "@/components/Witnesses/VotesHistoryDialog"; import VotesHistoryDialog from "@/components/Witnesses/VotesHistoryDialog";
import WitnessScheduleIcon from "@/components/WitnessScheduleIcon"; import WitnessScheduleIcon from "@/components/WitnessScheduleIcon";
import LastUpdatedWitnessIcon from "@/components/LastUpdatedWitnessIcon"; import LastUpdatedTooltip from "@/components/LastUpdatedTooltip";
const TABLE_CELLS = [ const TABLE_CELLS = [
"Rank", "Rank",
...@@ -170,8 +170,8 @@ export default function Witnesses() { ...@@ -170,8 +170,8 @@ export default function Witnesses() {
</Head> </Head>
<div className="md:m-8 max-w-[100vw] px-4"> <div className="md:m-8 max-w-[100vw] px-4">
<div className="flex justify-between mt-1 mx-1"> <div className="flex justify-between mt-1 mx-1">
<WitnessScheduleIcon/> <WitnessScheduleIcon />
<LastUpdatedWitnessIcon lastUpdatedAt={witnessesData.votes_updated_at} /> <LastUpdatedTooltip lastUpdatedAt={witnessesData.votes_updated_at} />
</div> </div>
<VotersDialog <VotersDialog
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment