From 68e999434c568380a8dff2cba633f417ba9ce5d6 Mon Sep 17 00:00:00 2001 From: Andrei Voinea <8058187+andreivcodes@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:21:35 +0200 Subject: [PATCH] wip --- .../[groupId]/components/feed/actions.ts | 14 +++++----- .../components/feed/items/VoteItem.tsx | 1 - .../components/menubar/FullViewBar.tsx | 3 +- .../components/timeline/BasicEvent.tsx | 9 ++++-- .../timeline/CommentsVolumeEvent.tsx | 2 +- .../components/timeline/ResultEvent.tsx | 9 ++++-- .../components/timeline/Timeline.tsx | 16 +++++------ .../components/timeline/VotesVolumeEvent.tsx | 2 +- .../ended_vote_types/ApprovalVote.tsx | 9 ++++-- .../timeline/ended_vote_types/BasicVote.tsx | 28 +++++++++++-------- .../ended_vote_types/RankedChoiceVote.tsx | 7 +++-- .../ended_vote_types/SingleChoiceVote.tsx | 7 +++-- .../ended_vote_types/WeightedVote.tsx | 7 +++-- 13 files changed, 68 insertions(+), 46 deletions(-) diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/feed/actions.ts b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/feed/actions.ts index ad78b2b6..91dae7d1 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/feed/actions.ts +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/feed/actions.ts @@ -423,12 +423,12 @@ export async function getDelegate( topicEndTimes = topics.map((topic) => topic.lastPostedAt.getTime()); } - // // Determine the start and end times based on proposals and topics - // const startTime = new Date( - // Math.min(...proposalStartTimes, ...topicStartTimes) - // ); + // Determine the start and end times based on proposals and topics + const startTime = new Date( + Math.min(...proposalStartTimes, ...topicStartTimes) + ); - // const endTime = new Date(Math.max(...proposalEndTimes, ...topicEndTimes)); + const endTime = new Date(Math.max(...proposalEndTimes, ...topicEndTimes)); // Fetch the delegate with all related data in one query const delegateData = await db @@ -451,8 +451,8 @@ export async function getDelegate( .leftJoin('voter', 'voter.id', 'delegateToVoter.voterId') .where('delegateToVoter.voterId', '=', voter.id) .where('delegate.daoId', '=', dao.id) - // .where('delegateToVoter.periodStart', '<=', startTime) - // .where('delegateToVoter.periodEnd', '>=', endTime) + .where('delegateToVoter.periodStart', '<=', startTime) + .where('delegateToVoter.periodEnd', '>=', endTime) .select([ 'delegate.id as delegateId', 'discourseUser.name as discourseName', diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/feed/items/VoteItem.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/feed/items/VoteItem.tsx index 696b9a03..95103b62 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/feed/items/VoteItem.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/feed/items/VoteItem.tsx @@ -202,7 +202,6 @@ const AuthorInfo = ({ authorName, authorPicture, voterAddress, - isDelegate, }: { authorName: string; authorPicture: string | null; diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/menubar/FullViewBar.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/menubar/FullViewBar.tsx index c6cf3118..8305fabe 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/menubar/FullViewBar.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/menubar/FullViewBar.tsx @@ -2,8 +2,7 @@ import { ViewEnum, VotesFilterEnum } from '@/app/searchParams'; import * as Popover from '@radix-ui/react-popover'; -import * as Switch from '@radix-ui/react-switch'; -import { ArrowDown, ArrowUp, Check, ChevronsUpDown } from 'lucide-react'; +import { ArrowDown, Check, ChevronsUpDown } from 'lucide-react'; import { parseAsBoolean, parseAsStringEnum, useQueryState } from 'nuqs'; import { useEffect, useRef } from 'react'; import { voteFilters } from './MenuBar'; diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/BasicEvent.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/BasicEvent.tsx index fb4d5ec6..67f44985 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/BasicEvent.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/BasicEvent.tsx @@ -11,12 +11,15 @@ interface BasicEventProps { export function BasicEvent({ content, url, last }: BasicEventProps) { return (
-
-
+
+
{!last && (
)}
{content}
diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/CommentsVolumeEvent.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/CommentsVolumeEvent.tsx index d20e84dc..e8856b7f 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/CommentsVolumeEvent.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/CommentsVolumeEvent.tsx @@ -9,7 +9,7 @@ export function CommentsVolumeEvent({ volume }: CommentsVolumeEventProps) { return (
-
-
+
+
{!last && (
)}
diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/Timeline.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/Timeline.tsx index 66718481..a18506a9 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/Timeline.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/Timeline.tsx @@ -36,7 +36,7 @@ export async function Timeline({ pt-24' >
-
+
{events.map((event, index) => { // Determine visibility based on filters and metadata @@ -135,7 +135,7 @@ export function LoadingTimeline() { >
{/* Top SVG Placeholder */} -
+
- +
{/* Vertical Line Placeholder */} -
+
{/* Bottom SVG Placeholder */} -
+
- +
diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/VotesVolumeEvent.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/VotesVolumeEvent.tsx index 893f60e9..6658a54c 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/VotesVolumeEvent.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/VotesVolumeEvent.tsx @@ -9,7 +9,7 @@ export function VotesVolumeEvent({ volume }: VotesVolumeEventProps) { return (
{ } return ( -
-
+
+
diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/BasicVote.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/BasicVote.tsx index 68df5b1d..3881984c 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/BasicVote.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/BasicVote.tsx @@ -28,10 +28,10 @@ type VotesByChoice = Record< >; const VOTE_COLORS = { - For: 'bg-green-500', - Against: 'bg-red-500', - Abstain: 'bg-yellow-500', - Unknown: 'bg-gray-500', + For: 'bg-for-600', + Against: 'bg-against-600', + Abstain: 'bg-abstain-600', + Unknown: 'bg-neutral-600', } as const; const MIN_VISIBLE_WIDTH_PERCENT = 1; // Minimum width for a vote to be visible (0.5% of total width) @@ -225,16 +225,20 @@ export const BasicVote = ({ proposal, votes }: BasicVoteProps) => { tooltip, isAggregated = false, }: { - color: 'bg-green-500' | 'bg-red-500' | 'bg-yellow-500' | 'bg-gray-500'; // Explicitly define the allowed CSS class names + color: + | 'bg-for-600' + | 'bg-against-600' + | 'bg-abstain-600' + | 'bg-neutral-600'; // Explicitly define the allowed CSS class names width: number; tooltip: string; isAggregated?: boolean; }) => { const colorMap = { - 'bg-green-500': '#22c55e', - 'bg-red-500': '#ef4444', - 'bg-yellow-500': '#eab308', - 'bg-gray-500': '#6b7280', + 'bg-for-600': '#56B200', + 'bg-against-600': '#FF4242', + 'bg-abstain-600': '#FFBC1F', + 'bg-neutral-600': '#6b7280', } as const; const cssColor = colorMap[color] || '#6b7280'; @@ -243,7 +247,9 @@ export const BasicVote = ({ proposal, votes }: BasicVoteProps) => {
{ return (
-
+
{(['For', 'Abstain', 'Against', 'Unknown'] as const).map((choice) => { const voteData = votesByChoice[choice]; if (!voteData) return null; diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/RankedChoiceVote.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/RankedChoiceVote.tsx index b1b4b9cf..4361744f 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/RankedChoiceVote.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/RankedChoiceVote.tsx @@ -125,9 +125,12 @@ export const RankedChoiceVote = ({ return (
-
+
diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/SingleChoiceVote.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/SingleChoiceVote.tsx index 50e74a8d..ed31354e 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/SingleChoiceVote.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/SingleChoiceVote.tsx @@ -89,9 +89,12 @@ export const SingleChoiceVote = ({ return (
-
+
diff --git a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/WeightedVote.tsx b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/WeightedVote.tsx index 0a3ffd3f..9b005e2c 100644 --- a/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/WeightedVote.tsx +++ b/apps/web-arbitrum/app/[daoSlug]/[groupId]/components/timeline/ended_vote_types/WeightedVote.tsx @@ -95,9 +95,12 @@ export const WeightedVote = ({ proposal, votes }: WeightedVoteProps) => { return (
-
+