fix: welcome import, marketplace text, photo info text

This commit is contained in:
David Ralph 2024-03-30 21:04:25 +00:00
parent c16205fd0f
commit 71c48b6896
5 changed files with 19 additions and 17 deletions

View File

@ -227,7 +227,7 @@ function PhotoInformation({ info, url, api }) {
<Download onClick={() => downloadImage(info)} /> <Download onClick={() => downloadImage(info)} />
</Tooltip> </Tooltip>
)} )}
{info.pun && ( {(info.pun && info.category) && (
<Tooltip <Tooltip
title={variables.getMessage('widgets.background.exclude')} title={variables.getMessage('widgets.background.exclude')}
key="exclude" key="exclude"
@ -375,7 +375,7 @@ function PhotoInformation({ info, url, api }) {
{info.views && info.downloads !== null ? <UnsplashStats /> : null} {info.views && info.downloads !== null ? <UnsplashStats /> : null}
</div> </div>
{showExtraInfo || other ? ( {(showExtraInfo || other) && excludeModal === false ? (
<> <>
<span className="subtitle"> <span className="subtitle">
{variables.getMessage('widgets.background.information')} {variables.getMessage('widgets.background.information')}

View File

@ -135,6 +135,9 @@ class Marketplace extends PureComponent {
} }
async getItems() { async getItems() {
this.setState({
done: false,
});
const dataURL = const dataURL =
this.props.type === 'collections' this.props.type === 'collections'
? variables.constants.API_URL + '/marketplace/collections' ? variables.constants.API_URL + '/marketplace/collections'

View File

@ -26,6 +26,7 @@ function WelcomeModal({ modalClose, modalSkip }) {
// State variables // State variables
const [currentTab, setCurrentTab] = useState(0); const [currentTab, setCurrentTab] = useState(0);
const [buttonText, setButtonText] = useState(variables.getMessage('modals.welcome.buttons.next')); const [buttonText, setButtonText] = useState(variables.getMessage('modals.welcome.buttons.next'));
const [importedSettings, setImportedSettings] = useState([]);
const finalTab = 6; const finalTab = 6;
// useEffect hook to handle tab changes and event bus listener // useEffect hook to handle tab changes and event bus listener
@ -125,11 +126,13 @@ function WelcomeModal({ modalClose, modalSkip }) {
const tabComponents = { const tabComponents = {
0: <Intro />, 0: <Intro />,
1: <ChooseLanguage />, 1: <ChooseLanguage />,
2: <ImportSettings switchTab={switchToTab} />, 2: <ImportSettings setImportedSettings={setImportedSettings} switchTab={switchToTab} />,
3: <ThemeSelection />, 3: <ThemeSelection />,
4: <StyleSelection />, 4: <StyleSelection />,
5: <PrivacyOptions />, 5: <PrivacyOptions />,
6: <Final currentTab={currentTab} switchTab={switchToTab} />, 6: (
<Final currentTab={currentTab} switchTab={switchToTab} importedSettings={importedSettings} />
),
}; };
// Current tab component // Current tab component

View File

@ -28,15 +28,14 @@ function Final(props) {
)} )}
</span> </span>
</div> </div>
{/*} {props.importedSettings.length !== 0 && (
{this.state.importedSettings.length !== 0 && ( <div className="toggle" onClick={() => props.switchTab(3)}>
<div className="toggle" onClick={() => this.props.switchTab(2)}> {variables.getMessage('modals.main.welcome.sections.final.imported', {
{variables.getMessage('modals.main.settings.sections.final.imported', { amount: props.importedSettings.length,
amount: this.state.importedSettings.length,
})}{' '} })}{' '}
{this.state.importedSettings.length} {props.importedSettings.length}
</div> </div>
)}*/} )}
</div> </div>
</Content> </Content>
); );

View File

@ -1,5 +1,4 @@
import variables from 'config/variables'; import variables from 'config/variables';
import { useState } from 'react';
import { FileUpload } from 'components/Form/Settings'; import { FileUpload } from 'components/Form/Settings';
import { MdCloudUpload } from 'react-icons/md'; import { MdCloudUpload } from 'react-icons/md';
import { importSettings as importSettingsFunction } from 'utils/settings'; import { importSettings as importSettingsFunction } from 'utils/settings';
@ -7,13 +6,11 @@ import { Header, Content } from '../Layout';
import default_settings from 'utils/data/default_settings.json'; import default_settings from 'utils/data/default_settings.json';
function ImportSettings(props) { function ImportSettings(props) {
const [importedSettings, setImportedSettings] = useState([]);
const importSettings = (e) => { const importSettings = (e) => {
importSettingsFunction(e); importSettingsFunction(e);
const settings = []; const settings = [];
const data = JSON.parse(e.target.result); const data = JSON.parse(e);
Object.keys(data).forEach((setting) => { Object.keys(data).forEach((setting) => {
// language and theme already shown, the others are only used internally // language and theme already shown, the others are only used internally
if ( if (
@ -39,8 +36,8 @@ function ImportSettings(props) {
}); });
}); });
setImportedSettings(settings); props.setImportedSettings(settings);
props.switchTab(5); props.switchTab(6);
}; };
return ( return (
<Content> <Content>