Finished translations / bug fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { FC, useMemo, useRef, useState } from 'react'
|
||||
import { ElementRef, FC, useMemo, useRef } from 'react'
|
||||
import { GroupBox } from './GroupBox/GroupBox'
|
||||
import styles from './Home.module.css'
|
||||
import { EnrichedEntity } from '../../src/types'
|
||||
@@ -8,15 +8,17 @@ import { Preferences } from './Preferences/Preferences'
|
||||
import { download, streamToArrayBuffer } from '../../src/download'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { I18n } from '../shared/I18n/I18n'
|
||||
import { i18n, I18n } from '../shared/I18n/I18n'
|
||||
import { useFactories } from '../contexts/FactoryProvider'
|
||||
import { GraphIcon } from '../icons/GraphIcon'
|
||||
import { useIntl } from 'react-intl'
|
||||
|
||||
export const Home: FC = () => {
|
||||
const intl = useIntl()
|
||||
const { query } = useRouter()
|
||||
const { factories } = useFactories()
|
||||
const { groups, addGroup, doNotSuggest, ignoredFactories, setIgnoredFactories, store, load } =
|
||||
useGroups()
|
||||
const [newGroupValue, setNewGroupValue] = useState('New group')
|
||||
const preferencesRef = useRef<ElementRef<typeof Preferences>>(null)
|
||||
const { groups, doNotSuggest, ignoredFactories, setIgnoredFactories, store, load } = useGroups()
|
||||
const inputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
const [missingExport, missingMall] = useMemo<[EnrichedEntity[], EnrichedEntity[]]>(() => {
|
||||
@@ -44,7 +46,7 @@ export const Home: FC = () => {
|
||||
download('factorio-microservices.bin', store())
|
||||
}}
|
||||
>
|
||||
Store
|
||||
<I18n id={'page.home.pref.download'} />
|
||||
</button>
|
||||
<input
|
||||
type={'file'}
|
||||
@@ -61,8 +63,13 @@ export const Home: FC = () => {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Link href={{ pathname: '/visualize', query }}>Visualize</Link>
|
||||
<Preferences />
|
||||
<Link href={{ pathname: '/visualize', query }}>
|
||||
<a>
|
||||
<I18n id={'page.home.pref.visualize'} />
|
||||
<GraphIcon />
|
||||
</a>
|
||||
</Link>
|
||||
<Preferences ref={preferencesRef} />
|
||||
<fieldset>
|
||||
<legend>
|
||||
<I18n id={'page.home.group.missing.export.title'} />
|
||||
@@ -76,17 +83,14 @@ export const Home: FC = () => {
|
||||
key={missing.href}
|
||||
value={missing}
|
||||
onClick={() => {
|
||||
addGroup(newGroupValue !== 'New group' ? newGroupValue : missing.name, [
|
||||
missing.href
|
||||
])
|
||||
setNewGroupValue('New group')
|
||||
preferencesRef.current?.addGroup(missing.name, [missing.href])
|
||||
}}
|
||||
onContextMenu={event => {
|
||||
event.preventDefault()
|
||||
setIgnoredFactories([...ignoredFactories, missing.href])
|
||||
}}
|
||||
leftClickText={'Create a new group with this name and item as exported factory'}
|
||||
rightClickText={'Exclude this recipe from suggestions'}
|
||||
leftClickText={i18n(intl, 'page.home.tooltip.action.add_to_new_export')}
|
||||
rightClickText={i18n(intl, 'page.home.tooltip.action.exclude_suggestion')}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -104,19 +108,14 @@ export const Home: FC = () => {
|
||||
key={missing.href}
|
||||
value={missing}
|
||||
onClick={() => {
|
||||
addGroup(
|
||||
newGroupValue !== 'New group' ? newGroupValue : missing.name,
|
||||
[],
|
||||
[missing.href]
|
||||
)
|
||||
setNewGroupValue('New group')
|
||||
preferencesRef.current?.addGroup(missing.name, undefined, [missing.href])
|
||||
}}
|
||||
onContextMenu={event => {
|
||||
event.preventDefault()
|
||||
setIgnoredFactories([...ignoredFactories, missing.href])
|
||||
}}
|
||||
leftClickText={'Create a new group with this name and item as mall factory'}
|
||||
rightClickText={'Exclude this recipe from suggestions'}
|
||||
leftClickText={i18n(intl, 'page.home.tooltip.action.add_to_new_mall')}
|
||||
rightClickText={i18n(intl, 'page.home.tooltip.action.exclude_suggestion')}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user