Skip to content

Commit

Permalink
Remove unused and confusing location properties
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Sep 7, 2023
1 parent ab3fa80 commit 510b65f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
9 changes: 1 addition & 8 deletions src/assets-dev/provider-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@ const i18nKeyPassThrough = {
// for providerLabel is happening in i18n-t in ProviderBanner, and providerTooltip is defined as a getter to not be
// constant but re-computed on language changes. providerLabel can include a {provider} placeholder which gets handled
// in i18n-t in ProviderBanner.
export const providersAssets: Record<Provider, Pick<Location, 'bg' | 'bgFullCard' | 'theme' | 'providerLabel' | 'providerTooltip' | 'providerTooltipCta'>> = {
export const providersAssets: Record<Provider, Pick<Location, 'bg' | 'theme' | 'providerLabel' | 'providerTooltip' | 'providerTooltipCta'>> = {
[Provider.DefaultShop]: {
bg: 'white',
bgFullCard: false,
theme: Theme.Light,

},
[Provider.DefaultAtm]: {
theme: Theme.Dark,
bgFullCard: true,
bg: 'radial-gradient(100% 100% at 100% 100%, #4D4C96 0%, #5F4B8B 100%)',
},
[Provider.GoCrypto]: {
theme: Theme.Light,
bgFullCard: false,
bg: '#F0BF4C',
get providerLabel() {
const i18n = i18nKeyPassThrough
Expand All @@ -44,7 +41,6 @@ export const providersAssets: Record<Provider, Pick<Location, 'bg' | 'bgFullCard
},
[Provider.Kurant]: {
theme: Theme.Dark,
bgFullCard: true,
bg: '#A92E19',
get providerLabel() {
const i18n = i18nKeyPassThrough
Expand All @@ -57,7 +53,6 @@ export const providersAssets: Record<Provider, Pick<Location, 'bg' | 'bgFullCard
},
[Provider.Bluecode]: {
bg: '#004899',
bgFullCard: false,
theme: Theme.Dark,
get providerLabel() {
const i18n = i18nKeyPassThrough
Expand All @@ -71,7 +66,6 @@ export const providersAssets: Record<Provider, Pick<Location, 'bg' | 'bgFullCard
[Provider.CryptopaymentLink]: {
bg: '#5C6CFF',
theme: Theme.Dark,
bgFullCard: false,
get providerLabel() {
const i18n = i18nKeyPassThrough
return i18n.t('Powered by {provider}')
Expand All @@ -84,7 +78,6 @@ export const providersAssets: Record<Provider, Pick<Location, 'bg' | 'bgFullCard
[Provider.Edenia]: {
bg: '#00B2B0',
theme: Theme.Dark,
bgFullCard: true,
get providerLabel() {
const i18n = i18nKeyPassThrough
return i18n.t('Register with {provider}')
Expand Down
3 changes: 1 addition & 2 deletions src/assets-dev/stories/locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Category, Currency, type Location, LocationLink, Provider } from 'types
import { providersAssets } from '../provider-assets'
import { translateCategory } from '@/translations'

type ExtraFields = Pick<Location, 'isAtm' | 'isShop' | 'isDark' | 'isLight' | 'provider' | 'category' | 'category_label' | 'providerLabel' | 'providerTooltip' | 'theme' | 'bg' | 'bgFullCard' | 'hasBottomBanner' | 'sells' | 'url' | 'linkTo'>
type ExtraFields = Pick<Location, 'isAtm' | 'isDark' | 'isLight' | 'provider' | 'category' | 'category_label' | 'providerLabel' | 'providerTooltip' | 'theme' | 'bg' | 'hasBottomBanner' | 'sells' | 'url' | 'linkTo'>
export function getExtra(provider: Provider, sells: Currency[] = [], linkTo: LocationLink = LocationLink.GMaps): ExtraFields {
const assets = providersAssets[provider]
if (!assets)
Expand All @@ -23,7 +23,6 @@ export function getExtra(provider: Provider, sells: Currency[] = [], linkTo: Loc

return {
isAtm,
isShop: !isAtm,
isDark: assets.theme === 'dark',
isLight: assets.theme === 'light',
...assets,
Expand Down
3 changes: 1 addition & 2 deletions src/shared.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PROVIDERS } from 'database'
import type { DatabaseArgs, Location } from 'types'
import { Category, LocationLink, Provider, Theme } from 'types'
import { LocationLink, Provider, Theme } from 'types'
import { providersAssets } from './assets-dev/provider-assets'
import { translateCategory } from './translations'

Expand Down Expand Up @@ -41,7 +41,6 @@ export function parseLocation(location: Location) {
Object.assign(location, providersAssets[location.provider]) // Assing all the keys from the asset to the location

location.isAtm = isAtm
location.isShop = location.category === Category.Shop
location.isDark = location.theme === Theme.Dark
location.isLight = location.theme === Theme.Light
location.hasBottomBanner = location.provider !== Provider.DefaultShop && location.provider !== Provider.DefaultAtm
Expand Down
2 changes: 0 additions & 2 deletions types/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export interface Location {

// UI Options
theme: Theme
bgFullCard: boolean
bg: string

// Provider text
Expand All @@ -58,7 +57,6 @@ export interface Location {

// Quick getters
isAtm: boolean
isShop: boolean
isDark: boolean
isLight: boolean
hasBottomBanner: boolean
Expand Down

0 comments on commit 510b65f

Please sign in to comment.