dcgtc / dgrants

Decentralized Grant platform that implements quadratic funding.
GNU Affero General Public License v3.0
84 stars 39 forks source link

Adjust `ptrToURI` to accept default placeholder for fallback #541

Closed gdixon closed 2 years ago

gdixon commented 2 years ago

Since ptrToURI is supposed to return the URI for any protocol's ID, what are your thoughts on this approach vs. changing ptrToURI to something like this:

function ptrToURI(logoPtr: MetaPtr | undefined | null, defaultURI: string = '/placeholder_grant.svg') {
  // ...
}

This way you can pass in a URI to default to if none is present from the provided logoPtr, and we don't need to duplicate the conditional protocol !== 0 check

_Originally posted by @mds1 in https://github.com/dcgtc/dgrants/pull/534#discussion_r758426315_