yearn / yearn.fi

https://yearn.fi
GNU General Public License v3.0
22 stars 49 forks source link

Feat - Hook useCurrentApp #27

Closed Majorfi closed 1 year ago

Majorfi commented 1 year ago

Create a basic hook to get the current App.

Ideally this should returns an identifier, but this could also returns all "specific" apps stuff (manifest, header, etc.)

    <img width="801" alt="Screenshot 2022-12-29 at 1 45 36 pm" src="https://user-images.githubusercontent.com/78794805/209946686-e3730117-ccce-4396-9aba-ea88f3e0213a.png">
function getCurrentApp(router) {
  if (router.pathname.startsWith('/ycrv')) {
    return 'yCRV';
  }
  if (router.pathname.startsWith('/vaults')) {
    return 'Vaults';
  }
  if (router.pathname.startsWith('/ybribe')) {
    return 'yBribe';
  }
  return 'Home';
}

_Originally posted by @karelianpie in https://github.com/yearn/yearn.fi/pull/24#discussion_r1058905886_

karelianpie commented 1 year ago

Strange that https://github.com/yearn/yearn.fi/pull/30#issue-1517838964 didn't close this PR