Skip to content

Commit

Permalink
finishes farcastle links
Browse files Browse the repository at this point in the history
  • Loading branch information
skuhlmann committed Nov 7, 2024
1 parent 01a6e0c commit bacd3dc
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 46 deletions.
1 change: 1 addition & 0 deletions apps/admin/src/components/CancelProposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const CancelProposal = ({
color="secondary"
rules={[daoExists, isConnectedToDao, addressCanCancel]}
onClick={handleCancel}
style={{ paddingLeft: '1rem', paddingRight: '1rem' }}
// centerAlign
>
{isLoading ? <Loading size={20} /> : 'Cancel'}
Expand Down
26 changes: 22 additions & 4 deletions apps/admin/src/pages/Proposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,33 @@ import {
useDaoProposal,
} from '@daohaus/moloch-v3-hooks';
import {
FarcastleButton,
ProposalActions,
ProposalDetailsContainer,
ProposalHistory,
} from '@daohaus/moloch-v3-macro-ui';
import { BiColumnLayout, Card, ParLg, Loading, widthQuery } from '@daohaus/ui';
import {
BiColumnLayout,
Card,
ParLg,
Loading,
widthQuery,
Button,

Check warning on line 19 in apps/admin/src/pages/Proposal.tsx

View workflow job for this annotation

GitHub Actions / build

'Button' is defined but never used
} from '@daohaus/ui';
import {
DAO_METHOD_TO_PROPOSAL_TYPE,
farcastleChain,
getFarcastleFramemUrl,

Check warning on line 24 in apps/admin/src/pages/Proposal.tsx

View workflow job for this annotation

GitHub Actions / build

'getFarcastleFramemUrl' is defined but never used
getProposalTypeLabel,
PROPOSAL_TYPE_LABELS,
PROPOSAL_TYPE_WARNINGS,
ProposalTypeIds,
SENSITIVE_PROPOSAL_TYPES,
} from '@daohaus/utils';

import { CancelProposal } from '../components/CancelProposal';

import FarcasterLogo from '../assets/farcaster-logo.svg';

Check warning on line 33 in apps/admin/src/pages/Proposal.tsx

View workflow job for this annotation

GitHub Actions / build

'FarcasterLogo' is defined but never used

const LoadingContainer = styled.div`
margin-top: 5rem;
`;
Expand Down Expand Up @@ -85,7 +95,16 @@ export const Proposal = () => {
)}`}
actions={
proposal && (
<CancelProposal proposal={proposal} onSuccess={() => refetch()} />
<>
<CancelProposal proposal={proposal} onSuccess={() => refetch()} />
{farcastleChain(daoChain) && (
<FarcastleButton
daoId={daoId}
daoChain={daoChain}
location={`proposals/${proposal.proposalId}`}
/>
)}
</>
)
}
left={
Expand All @@ -96,7 +115,6 @@ export const Proposal = () => {
daoId={daoId}
proposal={proposal}
includeLinks={true}
showFarcasterLink={farcastleChain(daoChain)}
proposalActionConfig={{
sensitiveProposalTypes: SENSITIVE_PROPOSAL_TYPES,
actionToProposalType: DAO_METHOD_TO_PROPOSAL_TYPE,
Expand Down
2 changes: 0 additions & 2 deletions apps/admin/src/pages/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useCurrentDao, useDaoData } from '@daohaus/moloch-v3-hooks';
import { SingleColumnLayout } from '@daohaus/ui';
import { DaoSettings } from '@daohaus/moloch-v3-macro-ui';
import { Keychain } from '@daohaus/keychain-utils';
import { farcastleChain } from '@daohaus/utils';

export const Settings = () => {
const { daoChain } = useCurrentDao();
Expand All @@ -16,7 +15,6 @@ export const Settings = () => {
daoChain={daoChain as keyof Keychain}
daoId={dao.id}
includeLinks={true}
showFarcasterLink={farcastleChain(daoChain)}
/>
)}
</SingleColumnLayout>
Expand Down
5 changes: 5 additions & 0 deletions libs/moloch-v3-macro-ui/src/assets/farcaster-logo-yellow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions libs/moloch-v3-macro-ui/src/assets/farcaster-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export const MetaCardHeader = styled.div`
margin-bottom: 3rem;
`;

export const MetaCardLinks = styled.div`
display: flex;
flex-wrap: wrap;
gap: 1rem;
`;

export const MetaContent = styled.div`
display: flex;
justify-content: flex-start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ type DaoSettingsProps = {
daoId: string;
includeLinks?: boolean;
graphApiKeys?: Keychain;
showFarcasterLink?: boolean;
};

export const DaoSettings = ({
daoChain,
daoId,
includeLinks = false,
graphApiKeys,
showFarcasterLink,
}: DaoSettingsProps) => {
const { dao } = useDaoData({
daoChain,
Expand All @@ -37,7 +35,6 @@ export const DaoSettings = ({
dao={dao}
daoChain={daoChain}
includeLinks={includeLinks}
showFarcasterLink={showFarcasterLink}
/>

<ContractSettings dao={dao} daoChain={daoChain} />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Button } from '@daohaus/ui';
import { getFarcastleFramemUrl } from '@daohaus/utils';

import FarcasterLogo from '../../assets/farcaster-logo.svg';

export const FarcastleButton = ({
daoId,
daoChain,
location,
}: {
daoId: string;
daoChain: string;
location?: string;
}) => {
return (
<Button
color="secondary"
href={getFarcastleFramemUrl({
daoId,
daoChain,
location,
})}
style={{ gap: '.5rem' }}
>
<img src={FarcasterLogo} alt="farcaster" width="22px" /> Cast
</Button>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {

import {
charLimit,
farcastleChain,
formatLongDateFromSeconds,
ZERO_ADDRESS,
} from '@daohaus/utils';
Expand All @@ -19,33 +20,28 @@ import { MolochV3Dao } from '@daohaus/moloch-v3-data';
import {
DaoProfileAvatar,
MetaCardHeader,
MetaCardLinks,
MetaContent,
SettingsContainer,
WarningContainer,
} from './DaoSettings.styles';
import { useDHConnect } from '@daohaus/connect';
import { useDaoMember } from '@daohaus/moloch-v3-hooks';
import {
ButtonRouterLink,
FarcasterShareLink,
SettingsLinkList,
TagList,
} from '../Layout';
import { ButtonRouterLink, SettingsLinkList, TagList } from '../Layout';
import { daoProfileHasLinks } from '../../utils/daoDataDisplayHelpers';
import { useMemo } from 'react';
import { FarcastleButton } from './FarcastleButton';

type MetadataSettingsProps = {
dao: MolochV3Dao;
daoChain: ValidNetwork;
includeLinks?: boolean;
showFarcasterLink?: boolean;
};

export const MetadataSettings = ({
dao,
daoChain,
includeLinks,
showFarcasterLink,
}: MetadataSettingsProps) => {
const { address } = useDHConnect();
const { member } = useDaoMember({
Expand All @@ -64,14 +60,19 @@ export const MetadataSettings = ({
<SettingsContainer>
<MetaCardHeader>
<H3>Metadata</H3>
{includeLinks && enableActions && (
<ButtonRouterLink
color="secondary"
to={`/molochv3/${daoChain}/${dao.id}/settings/update`}
>
Update Metadata
</ButtonRouterLink>
)}
<MetaCardLinks>
{includeLinks && enableActions && (
<ButtonRouterLink
color="secondary"
to={`/molochv3/${daoChain}/${dao.id}/settings/update`}
>
Update Metadata
</ButtonRouterLink>
)}
{farcastleChain(daoChain) && (
<FarcastleButton daoId={dao.id} daoChain={daoChain} />
)}
</MetaCardLinks>
</MetaCardHeader>
<MetaContent>
<div>
Expand Down Expand Up @@ -103,9 +104,6 @@ export const MetadataSettings = ({
{daoProfileHasLinks(dao.links) && (
<SettingsLinkList links={dao.links} />
)}
{showFarcasterLink && (
<FarcasterShareLink daoId={dao.id} daoChain={daoChain} />
)}
{dao.forwarder !== ZERO_ADDRESS && (
<WarningContainer>
<div className="title">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './ContractSettings';
export * from './DaoSettings';
export * from './FarcastleButton';
export * from './GovernanceSettings';
export * from './MetadataSettings';
export * from './ShamanSettings';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
} from 'react-icons/ri/index.js';

import { DaoProfileLink } from '@daohaus/moloch-v3-data';
import { DataMd, DataSm, Link, ParMd } from '@daohaus/ui';
import { DataMd, Link, ParMd } from '@daohaus/ui';
import { charLimit, getFarcastleFramemUrl } from '@daohaus/utils';
import FarcasterLogo from '../../assets/farcaster-logo.svg';
import FarcasterLogo from '../../assets/farcaster-logo-yellow.svg';

export const isPredefinedSettingsLink = (link: DaoProfileLink) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ type ProposalDetailsProps = {
actionData?: DecodedMultiTX | null;
decodeError: boolean;
proposalActionConfig?: ProposalActionConfig;
showFarcasterLink?: boolean;
};

export const ProposalDetails = ({
Expand All @@ -78,7 +77,6 @@ export const ProposalDetails = ({
actionData,
decodeError = false,
proposalActionConfig,
showFarcasterLink,
}: ProposalDetailsProps) => {
const { networks } = useDHConnect();
const { profile: submitterProfile } = useProfile({
Expand Down Expand Up @@ -206,14 +204,6 @@ export const ProposalDetails = ({
daoChain={daoChain}
proposalActionConfig={proposalActionConfig}
/>

{showFarcasterLink && (
<FarcasterShareLink
daoId={daoId}
daoChain={daoChain}
location={`proposals/${proposal.proposalId}`}
/>
)}
</OverviewContainer>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ type ProposalDetailsContainerProps = {
includeLinks: boolean;
proposalActionConfig?: ProposalActionConfig;
txLegos?: Record<string, TXLego>;
showFarcasterLink?: boolean;
};

export const ProposalDetailsContainer = ({
daoChain,
daoId,
proposal,
includeLinks = false,
showFarcasterLink,
proposalActionConfig = {
sensitiveProposalTypes: SENSITIVE_PROPOSAL_TYPES,
actionToProposalType: DAO_METHOD_TO_PROPOSAL_TYPE,
Expand Down Expand Up @@ -94,7 +92,6 @@ export const ProposalDetailsContainer = ({
actionData={actionData}
decodeError={decodeError}
includeLinks={includeLinks}
showFarcasterLink={showFarcasterLink}
proposalActionConfig={proposalActionConfig}
/>
<ProposalActionData
Expand Down

0 comments on commit bacd3dc

Please sign in to comment.