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

fixes for social links #121

Merged
merged 1 commit into from
Jan 29, 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
20 changes: 10 additions & 10 deletions packages/app/src/components/ViewCollective.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,26 @@ function ViewCollective({ collective }: ViewCollectiveProps) {
<Text style={styles.description}>{ipfs.description}</Text>
<View style={[styles.icons, { position: 'absolute', bottom: 0, left: 25 }]}>
{collective.ipfs.website && (
<Link href={collective.ipfs.website}>
<Link href={collective.ipfs.website} isExternal>
<Image source={WebIcon} style={styles.rowIcon} />
</Link>
)}
{collective.ipfs.twitter && (
<Link href={collective.ipfs.twitter}>
<Link href={collective.ipfs.twitter} isExternal>
<Image source={TwitterIcon} style={styles.rowIcon} />
</Link>
)}
{collective.ipfs.instagram && (
<Link href={collective.ipfs.instagram}>
<Link href={collective.ipfs.instagram} isExternal>
<Image source={InstagramIcon} style={styles.rowIcon} />
</Link>
)}
{collective.ipfs.threads && (
<Link href={collective.ipfs.threads}>
<Link href={collective.ipfs.threads} isExternal>
<Image source={AtIcon} style={styles.rowIcon} />
</Link>
)}
<Link href={`https://explorer.celo.org/mainnet/address/${poolAddress}`}>
<Link href={`https://explorer.celo.org/mainnet/address/${poolAddress}`} isExternal>
<Image source={LastRowIcon} style={styles.rowIcon} />
</Link>
</View>
Expand Down Expand Up @@ -249,26 +249,26 @@ function ViewCollective({ collective }: ViewCollectiveProps) {
<Text style={styles.description}>{ipfs.description}</Text>
<View style={styles.icons}>
{collective.ipfs.website && (
<Link href={collective.ipfs.website}>
<Link href={collective.ipfs.website} isExternal>
<Image source={WebIcon} style={styles.rowIcon} />
</Link>
)}
{collective.ipfs.twitter && (
<Link href={collective.ipfs.twitter}>
<Link href={collective.ipfs.twitter} isExternal>
<Image source={TwitterIcon} style={styles.rowIcon} />
</Link>
)}
{collective.ipfs.instagram && (
<Link href={collective.ipfs.instagram}>
<Link href={collective.ipfs.instagram} isExternal>
<Image source={InstagramIcon} style={styles.rowIcon} />
</Link>
)}
{collective.ipfs.threads && (
<Link href={collective.ipfs.threads}>
<Link href={collective.ipfs.threads} isExternal>
<Image source={AtIcon} style={styles.rowIcon} />
</Link>
)}
<Link href={`https://explorer.celo.org/mainnet/address/${poolAddress}`}>
<Link href={`https://explorer.celo.org/mainnet/address/${poolAddress}`} isExternal>
<Image source={LastRowIcon} style={styles.rowIcon} />
</Link>
</View>
Expand Down
60 changes: 3 additions & 57 deletions packages/app/src/subgraph/useSubgraphCollective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { gql } from '@apollo/client';
import { CollectivesSubgraphResponse, useSubgraphData } from './useSubgraphData';
import { SubgraphCollective } from './subgraphModels';

export const collective = gql`
query COLLECTIVE($id: String) {
collectives(where: { id: $id }) {
export const collectivesById = gql`
query COLLECTIVES_BY_ID($ids: [String!]) {
collectives(where: { id_in: $ids }) {
id
ipfs {
id
Expand Down Expand Up @@ -49,60 +49,6 @@ export const collective = gql`
}
`;

export const collectivesById = gql`
query COLLECTIVES_BY_ID($ids: [String!]) {
collectives(where: { id_in: $ids }) {
id
ipfs {
id
name
description
headerImage
}
stewards {
id
steward {
id
}
collective {
id
}
actions
totalEarned
}
donors {
id
donor {
id
}
collective {
id
}
contribution
timestamp
flowRate
}
timestamp
paymentsMade
totalDonations
totalRewards
}
}
`;

export function useSubgraphCollective(id: string): SubgraphCollective | undefined {
const response = useSubgraphData(collective, {
variables: {
id: id,
},
});
const data = (response as CollectivesSubgraphResponse).collectives;
if (!data || data.length === 0) {
return undefined;
}
return data[0];
}

export function useSubgraphCollectivesById(ids: string[]): SubgraphCollective[] | undefined {
const response = useSubgraphData(collectivesById, {
variables: {
Expand Down
Loading