Skip to content

Commit

Permalink
Minor refactoring of wording in renderer process
Browse files Browse the repository at this point in the history
  • Loading branch information
ransome1 committed Jan 18, 2025
1 parent 1e932be commit 3202288
Show file tree
Hide file tree
Showing 23 changed files with 245 additions and 213 deletions.
2 changes: 1 addition & 1 deletion src/main/modules/File/File.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function readFileContent(filePath: string, bookmark: string | null): string | Er
}

function addFile(filePath: string, bookmark: string | null) {
if (!bookmark) {
if (process.mas && !bookmark) {
mainWindow!.webContents.send('responseFromMainProcess', 'The Mac App Store release requires you to open files from within the app')
throw new Error('The Mac App Store release requires you to open files from within the app')
}
Expand Down
10 changes: 7 additions & 3 deletions src/renderer/Archive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { i18n } from './Settings/LanguageSelector'

const { ipcRenderer } = window.api

interface Props extends WithTranslation {
interface ArchiveComponentProps extends WithTranslation {
triggerArchiving: boolean
setTriggerArchiving: React.Dispatch<React.SetStateAction<boolean>>
settings: Settings
Expand All @@ -13,7 +13,11 @@ interface Props extends WithTranslation {
t: typeof i18n.t
}

const Archive: React.FC<Props> = ({ triggerArchiving, setPromptItem, t }) => {
const ArchiveComponent: React.FC<ArchiveComponentProps> = ({
triggerArchiving,
setPromptItem,
t
}) => {
const handleTriggerArchiving = (doneFileAvailable: boolean): void => {
setPromptItem(doneFileAvailable ? promptItemArchiving : promptItemChooseChangeFile)
}
Expand Down Expand Up @@ -64,4 +68,4 @@ const Archive: React.FC<Props> = ({ triggerArchiving, setPromptItem, t }) => {
return <></>
}

export default withTranslation()(Archive)
export default withTranslation()(ArchiveComponent)
8 changes: 4 additions & 4 deletions src/renderer/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { memo } from 'react'
import Menu from '@mui/material/Menu'
import MenuItem from '@mui/material/MenuItem'

interface ContextMenuProps {
interface ContextMenuComponentProps {
contextMenu: ContextMenu
setContextMenu: React.Dispatch<React.SetStateAction<ContextMenu | null>>
setPromptItem: React.Dispatch<React.SetStateAction<PromptItem | null>>
}

const ContextMenu: React.FC<ContextMenuProps> = memo(
const ContextMenuComponent: React.FC<ContextMenuComponentProps> = memo(
({ contextMenu, setContextMenu, setPromptItem }) => {
const onClick = (contextMenuItem: ContextMenuItem): void => {
if (contextMenuItem.promptItem) {
Expand Down Expand Up @@ -42,6 +42,6 @@ const ContextMenu: React.FC<ContextMenuProps> = memo(
}
)

ContextMenu.displayName = 'ContextMenu'
ContextMenuComponent.displayName = 'ContextMenuComponent'

export default ContextMenu
export default ContextMenuComponent
6 changes: 3 additions & 3 deletions src/renderer/Dialog/AutoSuggest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import './AutoSuggest.scss'

const regex: RegExp = /(?<=^| )[+@][^ ]*/g

interface AutoSuggestProps {
interface AutoSuggestComponentProps {
textFieldValue: string
setTextFieldValue: React.Dispatch<React.SetStateAction<string>>
attributes: Attributes | null
}

const AutoSuggest: React.FC<AutoSuggestProps> = ({
const AutoSuggestComponent: React.FC<AutoSuggestComponentProps> = ({
textFieldValue,
setTextFieldValue,
attributes
Expand Down Expand Up @@ -171,4 +171,4 @@ const AutoSuggest: React.FC<AutoSuggestProps> = ({
)
}

export default AutoSuggest
export default AutoSuggestComponent
10 changes: 8 additions & 2 deletions src/renderer/Dialog/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ import './DatePicker.scss'

dayjs.extend(updateLocale)

interface Props extends WithTranslation {
interface DatePickerComponentProps extends WithTranslation {
date: string | null
type: string
settings: Settings
handleChange: (type: string, value: dayjs.Dayjs | null) => void
t: typeof i18n.t
}

const DatePickerComponent: React.FC<Props> = ({ date, type, settings, handleChange, t }) => {
const DatePickerComponent: React.FC<DatePickerComponentProps> = ({
date,
type,
settings,
handleChange,
t
}) => {
dayjs.updateLocale(settings.language, {
weekStart: settings.weekStart
})
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import './Dialog.scss'

const { ipcRenderer } = window.api

interface Props extends WithTranslation {
interface DialogComponentProps extends WithTranslation {
dialogOpen: boolean
setDialogOpen: React.Dispatch<React.SetStateAction<boolean>>
todoObject: TodoObject | null
Expand All @@ -32,7 +32,7 @@ interface Props extends WithTranslation {
t: typeof i18n.t
}

const DialogComponent: React.FC<Props> = memo(
const DialogComponent: React.FC<DialogComponentProps> = memo(
({
dialogOpen,
setDialogOpen,
Expand Down
9 changes: 6 additions & 3 deletions src/renderer/Dialog/PomodoroPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import TextField from '@mui/material/TextField'
import TomatoIconDuo from '../tomato-duo.svg?asset'
import './PomodoroPicker.scss'

interface PomodoroPickerProps {
interface PomodoroPickerComponentProps {
pomodoro: number | string
handleChange: (key: string, value: string | number) => void
}

const PomodoroPicker: React.FC<PomodoroPickerProps> = ({ pomodoro, handleChange }) => {
const PomodoroPickerComponent: React.FC<PomodoroPickerComponentProps> = ({
pomodoro,
handleChange
}) => {
const handlePomodoroChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
handleChange('pm', event.target.value)
}
Expand All @@ -31,4 +34,4 @@ const PomodoroPicker: React.FC<PomodoroPickerProps> = ({ pomodoro, handleChange
)
}

export default PomodoroPicker
export default PomodoroPickerComponent
10 changes: 7 additions & 3 deletions src/renderer/Dialog/PriorityPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ const priorities = [
...alphabetArray.map((letter) => ({ value: letter, label: letter }))
]

interface PriorityPickerProps extends WithTranslation {
interface PriorityPickerComponentProps extends WithTranslation {
priority: string
handleChange: (key: string, value: string) => void
t: typeof i18n.t
}

const PriorityPicker: React.FC<PriorityPickerProps> = ({ priority, handleChange, t }) => {
const PriorityPickerComponent: React.FC<PriorityPickerComponentProps> = ({
priority,
handleChange,
t
}) => {
const handleSelectChange = (event: SelectChangeEvent<string>): void => {
handleChange('priority', event.target.value)
}
Expand All @@ -45,4 +49,4 @@ const PriorityPicker: React.FC<PriorityPickerProps> = ({ priority, handleChange,
)
}

export default withTranslation()(PriorityPicker)
export default withTranslation()(PriorityPickerComponent)
10 changes: 7 additions & 3 deletions src/renderer/Dialog/RecurrencePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ import { withTranslation, WithTranslation } from 'react-i18next'
import { i18n } from '../Settings/LanguageSelector'
import './RecurrencePicker.scss'

interface RecurrencePickerProps extends WithTranslation {
interface RecurrencePickerComponentProps extends WithTranslation {
recurrence: string | null
handleChange: (key: string, value: string) => void
t: typeof i18n.t
}

const RecurrencePicker: React.FC<RecurrencePickerProps> = ({ recurrence, handleChange, t }) => {
const RecurrencePickerComponent: React.FC<RecurrencePickerComponentProps> = ({
recurrence,
handleChange,
t
}) => {
const recurrenceFieldRef = useRef<HTMLInputElement | null>(null)
const [strictRecurrence, setStrictRecurrence] = useState<boolean>(false)
const [interval, setInterval] = useState<string | null>(null)
Expand Down Expand Up @@ -179,4 +183,4 @@ const RecurrencePicker: React.FC<RecurrencePickerProps> = ({ recurrence, handleC
)
}

export default withTranslation()(RecurrencePicker)
export default withTranslation()(RecurrencePickerComponent)
8 changes: 4 additions & 4 deletions src/renderer/Drawer/Attributes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import './Attributes.scss'

const { store } = window.api

interface DrawerAttributesProps extends WithTranslation {
interface DrawerAttributesComponentProps extends WithTranslation {
settings: Settings
attributes: Attributes | null
filters: Filters | null
t: typeof i18n.t
}

const DrawerAttributes: React.FC<DrawerAttributesProps> = memo(
const DrawerAttributesComponent: React.FC<DrawerAttributesComponentProps> = memo(
({ settings, attributes, filters, t }) => {
const [hovered, setHovered] = useState<string | null>(null)
const isAttributesEmpty = useMemo(
Expand Down Expand Up @@ -226,6 +226,6 @@ const DrawerAttributes: React.FC<DrawerAttributesProps> = memo(
}
)

DrawerAttributes.displayName = 'DrawerAttributes'
DrawerAttributesComponent.displayName = 'DrawerAttributesComponent'

export default withTranslation()(DrawerAttributes)
export default withTranslation()(DrawerAttributesComponent)
4 changes: 2 additions & 2 deletions src/renderer/Drawer/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import './Drawer.scss'

const { store } = window.api

interface Props extends WithTranslation {
interface DrawerComponentProps extends WithTranslation {
settings: Settings
attributes: Attributes | null
filters: Filters | null
searchFieldRef: React.RefObject<HTMLInputElement>
t: typeof i18n.t
}

const DrawerComponent: React.FC<Props> = memo(
const DrawerComponent: React.FC<DrawerComponentProps> = memo(
({ settings, attributes, filters, searchFieldRef, t }) => {
const [activeTab, setActiveTab] = useState<string>('attributes')
const [drawerWidth, setDrawerWidth] = useState<number>(store.getConfig('drawerWidth') || 500)
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/Drawer/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ const handleChange = (settingName: string, value: string | boolean): void => {
store.setConfig(settingName, value)
}

interface DrawerFiltersProps extends WithTranslation {
interface DrawerFiltersComponentProps extends WithTranslation {
settings: Settings
t: typeof i18n.t
}

const DrawerFilters: React.FC<DrawerFiltersProps> = ({ settings, t }) => {
const DrawerFiltersComponent: React.FC<DrawerFiltersComponentProps> = ({ settings, t }) => {
return (
<div id="Filters">
<FormGroup>
Expand Down Expand Up @@ -76,4 +76,4 @@ const DrawerFilters: React.FC<DrawerFiltersProps> = ({ settings, t }) => {
)
}

export default withTranslation()(DrawerFilters)
export default withTranslation()(DrawerFiltersComponent)
6 changes: 3 additions & 3 deletions src/renderer/Drawer/Sorting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import './Sorting.scss'

const { store } = window.api

interface Props extends WithTranslation {
interface DrawerSortingComponentProps extends WithTranslation {
settings: Settings
t: typeof i18n.t
}
Expand All @@ -28,7 +28,7 @@ const visibleSettings = {
}
}

const DrawerSorting: React.FC<Props> = ({ settings, t }) => {
const DrawerSortingComponent: React.FC<DrawerSortingComponentProps> = ({ settings, t }) => {
const [accordionOrder, setAccordionOrder] = useState<Sorting[]>(settings.sorting)

const moveItem = (index: number, direction: 'up' | 'down'): void => {
Expand Down Expand Up @@ -114,4 +114,4 @@ const DrawerSorting: React.FC<Props> = ({ settings, t }) => {
)
}

export default withTranslation()(DrawerSorting)
export default withTranslation()(DrawerSortingComponent)
13 changes: 10 additions & 3 deletions src/renderer/Grid/DatePickerInline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dayjs.extend(updateLocale)

const { ipcRenderer } = window.api

interface Props {
interface DatePickerInlineComponentProps {
type: string
todoObject: TodoObject
date: string | null
Expand All @@ -22,7 +22,14 @@ interface Props {
t: typeof i18n.t
}

const DatePickerInline: React.FC<Props> = ({ type, todoObject, date, filters, settings, t }) => {
const DatePickerInlineComponent: React.FC<DatePickerInlineComponentProps> = ({
type,
todoObject,
date,
filters,
settings,
t
}) => {
const [open, setOpen] = useState(false)
const chipText = type === 'due' ? 'due:' : type === 't' ? 't:' : null

Expand Down Expand Up @@ -123,4 +130,4 @@ const DatePickerInline: React.FC<Props> = ({ type, todoObject, date, filters, se
)
}

export default withTranslation()(DatePickerInline)
export default withTranslation()(DatePickerInlineComponent)
4 changes: 2 additions & 2 deletions src/renderer/Grid/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { ipcRenderer } = window.api

type HandleButtonClickType = (event: React.MouseEvent | React.KeyboardEvent) => void

interface Props extends WithTranslation {
interface RowProps extends WithTranslation {
todoObject: TodoObject
filters: Filters | null
setDialogOpen: React.Dispatch<React.SetStateAction<boolean>>
Expand All @@ -25,7 +25,7 @@ interface Props extends WithTranslation {
t: typeof i18n.t
}

const Row: React.FC<Props> = memo(
const Row: React.FC<RowProps> = memo(
({
todoObject,
filters,
Expand Down
Loading

0 comments on commit 3202288

Please sign in to comment.