Skip to content

Commit

Permalink
Fix: remove experimental address emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Nov 21, 2023
1 parent 09a88f6 commit b03a51d
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 186 deletions.
4 changes: 0 additions & 4 deletions src/components/balances/AssetsTable/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ describe('AssetsTable', () => {
onChainSigning: false,
},
transactionExecution: true,
addressEmojis: false,
},
},
})
Expand Down Expand Up @@ -216,7 +215,6 @@ describe('AssetsTable', () => {
onChainSigning: false,
},
transactionExecution: true,
addressEmojis: false,
},
},
})
Expand Down Expand Up @@ -319,7 +317,6 @@ describe('AssetsTable', () => {
onChainSigning: false,
},
transactionExecution: true,
addressEmojis: false,
},
},
})
Expand Down Expand Up @@ -419,7 +416,6 @@ describe('AssetsTable', () => {
onChainSigning: false,
},
transactionExecution: true,
addressEmojis: false,
},
},
})
Expand Down
1 change: 0 additions & 1 deletion src/components/balances/HiddenTokenButton/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ describe('HiddenTokenToggle', () => {
onChainSigning: false,
},
transactionExecution: true,
addressEmojis: false,
},
},
})
Expand Down
18 changes: 0 additions & 18 deletions src/components/common/AddressEmoji/AddressEmoji.test.tsx

This file was deleted.

62 changes: 0 additions & 62 deletions src/components/common/AddressEmoji/index.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/common/AddressEmoji/styles.module.css

This file was deleted.

4 changes: 0 additions & 4 deletions src/components/common/EthHashInfo/SrcEthHashInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import ExplorerButton, { type ExplorerButtonProps } from '../../ExplorerButton'
import { shortenAddress } from '@/utils/formatters'
import ImageFallback from '../../ImageFallback'
import css from './styles.module.css'
import { Emoji } from '../../AddressEmoji'

export type EthHashInfoProps = {
address: string
chainId?: string
name?: string | null
showAvatar?: boolean
showEmoji?: boolean
showCopyButton?: boolean
prefix?: string
showPrefix?: boolean
Expand All @@ -39,7 +37,6 @@ const SrcEthHashInfo = ({
showPrefix,
shortAddress = true,
showAvatar = true,
showEmoji,
avatarSize,
name,
showCopyButton,
Expand All @@ -65,7 +62,6 @@ const SrcEthHashInfo = ({
) : (
identicon
)}
{showEmoji && <Emoji address={address} size={avatarSize} />}
</div>
)}

Expand Down
11 changes: 0 additions & 11 deletions src/components/common/EthHashInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { selectSettings } from '@/store/settingsSlice'
import { selectChainById } from '@/store/chainsSlice'
import { getBlockExplorerLink } from '@/utils/chains'
import SrcEthHashInfo, { type EthHashInfoProps } from './SrcEthHashInfo'
import { selectAddedSafes } from '@/store/addedSafesSlice'
import useSafeAddress from '@/hooks/useSafeAddress'

const EthHashInfo = ({
showName = true,
Expand All @@ -16,18 +14,10 @@ const EthHashInfo = ({
}: EthHashInfoProps & { showName?: boolean }): ReactElement => {
const settings = useAppSelector(selectSettings)
const currentChainId = useChainId()
const safeAddress = useSafeAddress()
const addedSafes = useAppSelector((state) => selectAddedSafes(state, currentChainId)) || {}
const chain = useAppSelector((state) => selectChainById(state, props.chainId || currentChainId))
const addressBook = useAddressBook()
const link = chain ? getBlockExplorerLink(chain, props.address) : undefined
const name = showName ? addressBook[props.address] || props.name : undefined
const showEmoji =
settings.addressEmojis &&
props.showAvatar !== false &&
!props.customAvatar &&
avatarSize >= 20 &&
(safeAddress === props.address || props.address in addedSafes)

return (
<SrcEthHashInfo
Expand All @@ -39,7 +29,6 @@ const EthHashInfo = ({
customAvatar={props.customAvatar}
ExplorerButtonProps={{ title: link?.title || '', href: link?.href || '' }}
avatarSize={avatarSize}
showEmoji={showEmoji}
>
{props.children}
</SrcEthHashInfo>
Expand Down
2 changes: 0 additions & 2 deletions src/components/common/SafeIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Box } from '@mui/material'

import css from './styles.module.css'
import Identicon, { type IdenticonProps } from '../Identicon'
import AddressEmoji from '../AddressEmoji'

interface ThresholdProps {
threshold: number | string
Expand All @@ -25,7 +24,6 @@ const SafeIcon = ({ address, threshold, owners, size }: SafeIconProps): ReactEle
<div className={css.container}>
{threshold && owners ? <Threshold threshold={threshold} owners={owners} /> : null}
<Identicon address={address} size={size} />
<AddressEmoji address={address} size={size} />
</div>
)

Expand Down
23 changes: 0 additions & 23 deletions src/components/settings/EmojiPreview/index.tsx

This file was deleted.

35 changes: 3 additions & 32 deletions src/pages/settings/appearance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,23 @@ import type { NextPage } from 'next'
import Head from 'next/head'

import { useAppDispatch, useAppSelector } from '@/store'
import {
selectSettings,
setCopyShortName,
setDarkMode,
setShowShortName,
setAddressEmojis,
} from '@/store/settingsSlice'
import { selectSettings, setCopyShortName, setDarkMode, setShowShortName } from '@/store/settingsSlice'
import SettingsHeader from '@/components/settings/SettingsHeader'
import { trackEvent, SETTINGS_EVENTS } from '@/services/analytics'
import { useDarkMode } from '@/hooks/useDarkMode'
import ExternalLink from '@/components/common/ExternalLink'
import EmojiPreview from '@/components/settings/EmojiPreview'

const Appearance: NextPage = () => {
const dispatch = useAppDispatch()
const settings = useAppSelector(selectSettings)
const isDarkMode = useDarkMode()

const handleToggle = (
action: typeof setCopyShortName | typeof setDarkMode | typeof setShowShortName | typeof setAddressEmojis,
action: typeof setCopyShortName | typeof setDarkMode | typeof setShowShortName,
event:
| typeof SETTINGS_EVENTS.APPEARANCE.PREPEND_PREFIXES
| typeof SETTINGS_EVENTS.APPEARANCE.COPY_PREFIXES
| typeof SETTINGS_EVENTS.APPEARANCE.DARK_MODE
| typeof SETTINGS_EVENTS.APPEARANCE.ADDRESS_EMOJIS,
| typeof SETTINGS_EVENTS.APPEARANCE.DARK_MODE,
) => {
return (_: ChangeEvent<HTMLInputElement>, checked: boolean) => {
dispatch(action(checked))
Expand Down Expand Up @@ -105,27 +97,6 @@ const Appearance: NextPage = () => {
/>
</Grid>
</Grid>

<Grid container spacing={3} mt={2}>
<Grid item lg={4} xs={12}>
<Typography variant="h4" fontWeight="bold">
Experimental
</Typography>
</Grid>

<Grid item xs>
<FormControlLabel
control={
<Switch
checked={settings.addressEmojis}
onChange={handleToggle(setAddressEmojis, SETTINGS_EVENTS.APPEARANCE.ADDRESS_EMOJIS)}
/>
}
label="Address emoji"
/>
<EmojiPreview />
</Grid>
</Grid>
</Paper>
</main>
</>
Expand Down
4 changes: 0 additions & 4 deletions src/services/analytics/events/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ export const SETTINGS_EVENTS = {
action: 'Dark mode',
category: SETTINGS_CATEGORY,
},
ADDRESS_EMOJIS: {
action: 'Toggle address emojis',
category: SETTINGS_CATEGORY,
},
},
MODULES: {
REMOVE_MODULE: {
Expand Down
6 changes: 0 additions & 6 deletions src/store/settingsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export type SettingsState = {
onChainSigning: boolean
}
transactionExecution: boolean
addressEmojis: boolean
}

export const initialState: SettingsState = {
Expand All @@ -69,7 +68,6 @@ export const initialState: SettingsState = {
onChainSigning: false,
},
transactionExecution: true,
addressEmojis: false,
}

export const settingsSlice = createSlice({
Expand All @@ -94,9 +92,6 @@ export const settingsSlice = createSlice({
setDarkMode: (state, { payload }: PayloadAction<SettingsState['theme']['darkMode']>) => {
state.theme.darkMode = payload
},
setAddressEmojis: (state, { payload }: PayloadAction<SettingsState['addressEmojis']>) => {
state.addressEmojis = payload
},
setHiddenTokensForChain: (state, { payload }: PayloadAction<{ chainId: string; assets: string[] }>) => {
const { chainId, assets } = payload
state.hiddenTokens[chainId] = assets
Expand Down Expand Up @@ -132,7 +127,6 @@ export const {
setCopyShortName,
setQrShortName,
setDarkMode,
setAddressEmojis,
setHiddenTokensForChain,
setTokenList,
setRpc,
Expand Down

0 comments on commit b03a51d

Please sign in to comment.