Skip to content

Commit

Permalink
Code Refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
awaisalee committed Oct 30, 2024
1 parent 1780cb8 commit 1c45c0d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/desktop-client/src/components/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React, {
import { useDispatch, useSelector } from 'react-redux';

import { css } from '@emotion/css';
import { t } from 'i18next';

import { removeNotification } from 'loot-core/client/actions';
import { type State } from 'loot-core/src/client/state-types';
Expand Down Expand Up @@ -231,7 +232,7 @@ function Notification({
</Stack>
<Button
variant="bare"
aria-label="Close"
aria-label={t('Close')}
style={{ flexShrink: 0, color: 'currentColor' }}
onPress={onRemove}
>
Expand Down
5 changes: 2 additions & 3 deletions packages/desktop-client/src/components/UpdateNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export function UpdateNotification() {
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<View style={{ marginRight: 10, fontWeight: 700 }}>
<Text>
{t('App updated to ')}
{updateInfo.version}
{t('App updated to {{version}}', { version: updateInfo.version })}
</Text>
</View>
<View style={{ flex: 1 }} />
Expand Down Expand Up @@ -78,7 +77,7 @@ export function UpdateNotification() {
)
<Button
variant="bare"
aria-label="Close"
aria-label={t('Close')}
style={{ display: 'inline', padding: '1px 7px 2px 7px' }}
onPress={() => {
// Set a flag to never show an update notification again for this session
Expand Down
7 changes: 4 additions & 3 deletions packages/desktop-client/src/components/common/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useHotkeysContext } from 'react-hotkeys-hook';

import { css } from '@emotion/css';
import { AutoTextSize } from 'auto-text-size';
import { t } from 'i18next';

import { useModalState } from '../../hooks/useModalState';
import { AnimatedLoading } from '../../icons/AnimatedLoading';
Expand Down Expand Up @@ -90,7 +91,7 @@ export const Modal = ({
<ReactAriaModal>
{modalProps => (
<Dialog
aria-label="Modal dialog"
aria-label={t('Modal dialog')}
className={css(styles.lightScrollbar)}
style={{
outline: 'none', // remove focus outline
Expand Down Expand Up @@ -319,7 +320,7 @@ export function ModalHeader({
>
{showLogo && (
<SvgLogo
aria-label="Modal logo"
aria-label={t('Modal logo')}
width={30}
height={30}
style={{ justifyContent: 'center', alignSelf: 'center' }}
Expand Down Expand Up @@ -462,7 +463,7 @@ export function ModalCloseButton({ onPress, style }: ModalCloseButtonProps) {
variant="bare"
onPress={onPress}
style={{ padding: '10px 10px' }}
aria-label="Close"
aria-label={t('Close')}
>
<SvgDelete width={10} style={style} />
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import React, {
import { useDispatch } from 'react-redux';
import { Item, Section } from 'react-stately';

import { t } from 'i18next';

import { setNotificationInset } from 'loot-core/client/actions';
import { groupById, integerToCurrency } from 'loot-core/shared/util';
import * as monthUtils from 'loot-core/src/shared/months';
Expand Down Expand Up @@ -91,7 +93,7 @@ export function TransactionList({
if (isLoading) {
return (
<View
aria-label="Loading..."
aria-label={t('Loading...')}
style={{
flex: 1,
justifyContent: 'center',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// @ts-strict-ignore
import React, { useRef, useState, type CSSProperties } from 'react';

import { t } from 'i18next';

import { type CategoryEntity } from 'loot-core/src/types/models';

import { useCategory } from '../../hooks/useCategory';
Expand Down Expand Up @@ -173,7 +175,7 @@ function AdditionalCategoryMenu({
<Button
ref={triggerRef}
variant="bare"
aria-label="Menu"
aria-label={t('Menu')}
onPress={() => {
setMenuOpen(true);
}}
Expand Down

0 comments on commit 1c45c0d

Please sign in to comment.