Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix : reversing groups and pages list to make recent ones appear first #60

Merged
merged 3 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion apps/web-app/src/app/group/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export default function GroupsPage() {
}
}, [_users, setLog])

const users = useMemo(() => [..._users].reverse(), [_users])

const joinGroup = useCallback(async () => {
if (!_identity) {
return
Expand Down Expand Up @@ -130,7 +132,7 @@ export default function GroupsPage() {

{_users.length > 0 && (
<VStack spacing="3" pb="3" align="left" maxHeight="300px" overflowY="scroll">
{_users.map((user, i) => (
{users.map((user, i) => (
<HStack key={i} pb="3" borderBottomWidth={i < _users.length - 1 ? 1 : 0} whiteSpace="nowrap">
<Text textOverflow="ellipsis" overflow="hidden">
{_identity?.commitment === user ? <b>{user}</b> : user}
Expand Down
6 changes: 4 additions & 2 deletions apps/web-app/src/app/proofs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Box, Button, Divider, Heading, HStack, Link, Text, useBoolean, VStack }
import { generateProof, Group } from "@semaphore-protocol/core"
import { encodeBytes32String, ethers } from "ethers"
import { useRouter } from "next/navigation"
import { useCallback, useEffect } from "react"
import { useCallback, useEffect, useMemo } from "react"
import Feedback from "../../../contract-artifacts/Feedback.json"
import useSemaphoreIdentity from "@/hooks/useSemaphoreIdentity"

Expand All @@ -25,6 +25,8 @@ export default function ProofsPage() {
}
}, [_feedback, setLog])

const feedback = useMemo(() => [..._feedback].reverse(), [_feedback])

const sendFeedback = useCallback(async () => {
if (!_identity) {
return
Expand Down Expand Up @@ -161,7 +163,7 @@ export default function ProofsPage() {

{_feedback.length > 0 && (
<VStack spacing="3" pb="3" align="left" maxHeight="300px" overflowY="scroll">
{_feedback.map((f, i) => (
{feedback.map((f, i) => (
<HStack key={i} pb="3" borderBottomWidth={i < _feedback.length - 1 ? 1 : 0}>
<Text>{f}</Text>
</HStack>
Expand Down