Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-alpha.37'
Browse files Browse the repository at this point in the history
  • Loading branch information
nekofar committed Apr 3, 2024
2 parents 1bbdacf + 13d45ad commit dac8387
Show file tree
Hide file tree
Showing 29 changed files with 2,364 additions and 464 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## [1.0.0-alpha.37] - 2024-04-03

### Features

- Migrate updates from upstream (#241)

## [1.0.0-alpha.35] - 2024-03-22

### Features
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions apps/nouns-camp/src/app/voters/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import ClientAppProvider from "../client-app-provider.js";
import BrowseAccountsScreen from "../../components/browse-accounts-screen.js";

export const runtime = "edge";

export default function Page() {
return (
<ClientAppProvider>
<BrowseAccountsScreen />
</ClientAppProvider>
);
}
15 changes: 12 additions & 3 deletions apps/nouns-camp/src/components/account-avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { css } from "@emotion/react";
import { useEnsName, useEnsAvatar } from "wagmi";
import { array as arrayUtils } from "@shades/common/utils";
import Avatar from "@shades/ui-web/avatar";
import { useDelegate } from "../store.js";
import { useNounsRepresented } from "../store.js";
import { useNounSeeds } from "../hooks/token-contract.js";

const { reverse } = arrayUtils;

Expand Down Expand Up @@ -38,15 +39,23 @@ const NounsAccountAvatar = React.forwardRef(
},
ref,
) => {
const delegate = useDelegate(accountAddress);
const nounSeeds = delegate?.nounsRepresented.map((n) => n.seed);
const nouns = useNounsRepresented(accountAddress);

const { data: ensName } = useEnsName({ address: accountAddress });
const { data: ensAvatarUrl } = useEnsAvatar({
name: ensName,
enabled: ensName != null,
});

// const isMissingSeeds = nouns != null && nouns.some((n) => n.seed == null);

const fetchedNounSeeds = useNounSeeds(nouns?.map((n) => n.id) ?? [], {
enabled: false,
// enabled: !ensOnly && ensAvatarUrl == null && isMissingSeeds,
});

const nounSeeds = fetchedNounSeeds ?? nouns?.map((n) => n.seed);

const enablePlaceholder = ensAvatarUrl == null;

const nounAvatarUrls = useNounAvatars(nounSeeds, {
Expand Down
11 changes: 6 additions & 5 deletions apps/nouns-camp/src/components/account-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ const Content = ({ titleProps, dismiss }) => {

const hasNouns = account?.nouns.length > 0;
const nounsRepresented = delegate?.nounsRepresented ?? [];
const nounsDelegatedToAccount = nounsRepresented.filter(
(n) => n.ownerId.toLowerCase() !== accountAddress,
);
const voteCount = nounsRepresented.length;
const votePowerQuorumPercentage =
currentQuorum == null
Expand Down Expand Up @@ -202,15 +205,13 @@ const Content = ({ titleProps, dismiss }) => {
</dd>
</>
)}
{voteCount > 0 && (
{nounsDelegatedToAccount.length > 0 && (
<>
<dt>Nouns delegated to you</dt>
<dd data-block>
<NounList
contextAccount={accountAddress}
items={nounsRepresented.filter(
(n) => n.ownerId.toLowerCase() !== accountAddress,
)}
items={nounsDelegatedToAccount}
/>
</dd>
</>
Expand Down Expand Up @@ -242,7 +243,7 @@ const Content = ({ titleProps, dismiss }) => {
<Button
onClick={() => {
dismiss();
navigate(`/campers/${ensName ?? accountAddress}`);
navigate(`/voters/${ensName ?? accountAddress}`);
}}
>
Account page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const AccountPreview = React.forwardRef(({ accountAddress, close }, ref) => {

const { open: openDelegationDialog } = useDialog("delegation");

const accountLink = `/campers/${ensName ?? accountAddress}`;
const accountLink = `/voters/${ensName ?? accountAddress}`;

return (
<div
Expand Down
54 changes: 49 additions & 5 deletions apps/nouns-camp/src/components/activity-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const FeedItem = React.memo(({ context, onQuote, ...item }) => {
<NextLink
href={
context !== "proposal"
? `/proposals/${item.proposalId}#${quote.id}`
? `/proposals/${item.proposalId}?tab=activity#${quote.id}`
: `#${quote.id}`
}
style={{ display: "block", position: "absolute", inset: 0 }}
Expand All @@ -226,6 +226,35 @@ const FeedItem = React.memo(({ context, onQuote, ...item }) => {
accountAddress={quote.authorAccount}
style={{ position: "relative" }}
/>
{(() => {
if (item.quotes.every((q) => q.support === item.support))
return null;

return (
<span
css={(t) =>
css({
fontWeight: t.text.weights.emphasis,
"[data-for]": { color: t.colors.textPositive },
"[data-against]": { color: t.colors.textNegative },
"[data-abstain]": { color: t.colors.textDimmed },
})
}
>
{" "}
{(() => {
switch (quote.support) {
case 0:
return <Signal negative>(against)</Signal>;
case 1:
return <Signal positive>(for)</Signal>;
case 2:
return <Signal>(abstained)</Signal>;
}
})()}
</span>
);
})()}
:{" "}
<MarkdownRichText
text={quote.body}
Expand Down Expand Up @@ -388,7 +417,7 @@ const ItemTitle = ({ item, context }) => {
const ContextLink = ({ proposalId, candidateId, short, children }) => {
if (proposalId != null) {
const title =
proposal?.title == null
proposal?.title == null || proposal.title.length > 130
? `Proposal ${proposalId}`
: `${short ? proposalId : `Proposal ${proposalId}`}: ${
proposal.title
Expand Down Expand Up @@ -685,9 +714,24 @@ const ItemTitle = ({ item, context }) => {
case "vote":
case "feedback-post": {
const signalWord = (() => {
if (item.type === "feedback-post") return "signaled";
const isRevote = item.quotes?.some((quote) => quote.type === "vote");
return isRevote ? "revoted" : "voted";
const isRepost =
item.quotes?.length > 0 &&
item.quotes.every((quote) => quote.support === item.support);

if (isRepost) {
const isRevote =
item.type === "vote" && item.quotes.some((q) => q.type === "vote");
return isRevote ? "revoted" : "reposted";
}

switch (item.type) {
case "vote":
return "voted";
case "feedback-post":
return "signaled";
default:
throw new Error();
}
})();
return (
<span>
Expand Down
Loading

0 comments on commit dac8387

Please sign in to comment.