fix: photo info share modal, navbar, remove unused code

This commit is contained in:
David Ralph
2022-05-23 20:31:14 +01:00
parent b070f4a1ce
commit 4f29d376ca
12 changed files with 22 additions and 85 deletions

View File

@@ -8,7 +8,7 @@ import { toast } from 'react-toastify';
import './sharemodal.scss';
export default function ShareModal({ modalClose, data, type }) {
export default function ShareModal({ modalClose, data }) {
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
const url = variables.constants.MARKETPLACE_URL + '/share/' + btoa(data.api_name);
@@ -17,6 +17,10 @@ export default function ShareModal({ modalClose, data, type }) {
toast('Link copied!');
};
if (!data.data) {
data.data.name = 'this image';
}
return (
<div className="smallModal">
<div className="shareHeader">
@@ -33,7 +37,7 @@ export default function ShareModal({ modalClose, data, type }) {
onClick={() =>
window
.open(
`https://twitter.com/intent/tweet?text=Check out ${data.data.name} on @getmue marketplace: ${data}`,
`https://twitter.com/intent/tweet?text=Check out ${data.data.name} on @getmue: ${data}`,
'_blank',
)
.focus()
@@ -56,7 +60,7 @@ export default function ShareModal({ modalClose, data, type }) {
onClick={() =>
window
.open(
'mailto:email@example.com?subject=Check%20out%20this%20Mue%20addon!&body=' +
'mailto:email@example.com?subject=Check%20out%20this%20%on%20%Mue!&body=' +
data.data.name +
'on Mue: ' +
data,
@@ -68,9 +72,6 @@ export default function ShareModal({ modalClose, data, type }) {
<MdEmail />
</button>
</Tooltip>
{/* i think that wechat has no actual share function outside of qrcodes, as the only example of a share to wechat button i've seen used this api
* this requires some investigating before we deploy to production
*/}
<Tooltip title="WeChat">
<button
onClick={() =>

View File

@@ -243,13 +243,6 @@ export default class Item extends PureComponent {
</div>
) : null}
{warningHTML}
{/*<div className="itemWarning">
<div className="topRow">
<NewReleasesRounded />
<div className="title">Update</div>
</div>
<div className="subtitle">React > Vue</div>
</div>*/}
</div>
</div>
</div>

View File

@@ -128,11 +128,6 @@ export default class Added extends PureComponent {
return (
<div className="emptyItems">
<div className="emptyNewMessage">
{/*<MdLocalMall />
<span className="title">{this.getMessage('modals.main.addons.empty.title')}</span>
<span className="subtitle">
{this.getMessage('modals.main.addons.empty.description')}
</span>*/}
<MdOutlineExtensionOff />
<span className="title">{this.getMessage('modals.main.addons.empty.title')}</span>
<span className="subtitle">

View File

@@ -224,14 +224,6 @@ export default class Create extends PureComponent {
onInput={(e) => setMetadata(e.target.value, 'name')}
/>
</SettingsItem>
{/*<SettingsItem title={getMessage('modals.main.marketplace.product.version')}>
<TextField
varient="outlined"
InputLabelProps={{ shrink: true }}
value={this.state.addonMetadata.version}
onInput={(e) => setMetadata(e.target.value, 'version')}
/>
</SettingsItem>*/}
<div className="settingsRow">
<div className="content">
<span className="title">{getMessage('modals.main.marketplace.product.version')}</span>

View File

@@ -310,7 +310,6 @@ export default class Marketplace extends PureComponent {
) : (
<span className="mainTitle">Marketplace</span>
)}
{/*{featured()}*/}
<div className="filter">
<Dropdown
label={this.getMessage('modals.main.addons.sort.title')}

View File

@@ -63,7 +63,6 @@ export default class SliderComponent extends PureComponent {
<>
<span className={'sliderTitle'}>
{this.props.title}
{/*<span>{Number(this.state.value / 100)}x</span>*/}
<span>{Number(this.state.value)}</span>
<span className="link" onClick={this.resetItem}>
<MdRefresh />

View File

@@ -132,11 +132,6 @@ export default function AppearanceSettings() {
/>
</SettingsItem>
{/*<h3>{getMessage('modals.main.settings.sections.appearance.accessibility.title')}</h3>
<Checkbox text={getMessage('modals.main.settings.sections.appearance.accessibility.text_shadow')} name='textBorder' category='other'/>
<Checkbox text={getMessage('modals.main.settings.sections.appearance.accessibility.animations')} name='animations' category='other'/>
<Slider title={getMessage('modals.main.settings.sections.appearance.accessibility.toast_duration')} name='toastDisplayTime' default='2500' step='100' min='500' max='5000' marks={values('toast')}
display={' ' + getMessage('modals.main.settings.sections.appearance.accessibility.milliseconds')} />*/}
<SettingsItem
title={getMessage('modals.main.settings.sections.appearance.accessibility.title')}
subtitle="Accessibility settings for Mue"

View File

@@ -59,8 +59,6 @@ export default class Stats extends PureComponent {
return (
<>
{/*<h2>{getMessage('modals.main.settings.sections.stats.title')}</h2>
<Switch name='stats' text={getMessage('modals.main.settings.sections.stats.usage')} category='stats'/>*/}
<span className="mainTitle">{getMessage('modals.main.settings.sections.stats.title')}</span>
<SettingsItem
title={getMessage('modals.main.settings.reminder.title')}

View File

@@ -187,7 +187,6 @@ export default class CustomSettings extends PureComponent {
</div>
</div>
<div className="action">
{/*<button onClick={() => this.uploadCustomBackground()}>{this.getMessage('modals.main.settings.sections.background.source.add_background')} <MdAddPhotoAlternate/></button>*/}
<div className="dropzone" ref={this.customDnd}>
<MdAddPhotoAlternate />
<span className="title">Drop to upload</span>
@@ -200,12 +199,6 @@ export default class CustomSettings extends PureComponent {
{this.getMessage('modals.main.settings.sections.background.source.add_url')}{' '}
<MdAddLink />
</button>
{/*<span className='subtitle'>
{this.getMessage('modals.main.settings.sections.background.source.custom_background')}{' '}
<span className="link" onClick={this.resetCustom}>
{this.getMessage('modals.main.settings.buttons.reset')}
</span>
</span>*/}
</div>
</div>
<FileUpload

View File

@@ -36,13 +36,6 @@ const downloadImage = async (info) => {
variables.stats.postEvent('feature', 'Background download');
};
// todo: copy link to unsplash/pexels page not image url
const copyImage = (info) => {
variables.stats.postEvent('feature', 'Background copied');
navigator.clipboard.writeText(info.url);
toast('Background copied');
};
export default function PhotoInformation({ info, url, api }) {
const [width, setWidth] = useState(0);
const [height, setHeight] = useState(0);
@@ -63,7 +56,6 @@ export default function PhotoInformation({ info, url, api }) {
'widgets.background.unsplash',
);
const pexels = variables.language.getMessage(variables.languagecode, 'widgets.background.pexels');
const photographer = info.credit.split(` ${unsplash}`)[0].split(` ${pexels}`);
let credit = info.credit;
let photo = variables.language.getMessage(variables.languagecode, 'widgets.background.credit');
@@ -121,22 +113,18 @@ export default function PhotoInformation({ info, url, api }) {
// info is still there because we want the favourite button to work
if (localStorage.getItem('photoInformation') === 'false') {
return (
<div className="photoInformation">
<h1>
{photo} <span id="credit">{credit}</span>
</h1>
<div style={{ display: 'none' }}>
<span id="infoLocation">{info.location || 'N/A'}</span>
<span id="infoCamera">{info.camera || 'N/A'}</span>
<span id="infoResolution">
{width}x{height}
</span>
</div>
<div style={{ display: 'none' }}>
<span id="credit">{credit}</span>
<span id="infoLocation">{info.location || 'N/A'}</span>
<span id="infoCamera">{info.camera || 'N/A'}</span>
<span id="infoResolution">
{width}x{height}
</span>
</div>
);
}
const downloadEnabled =
/*const downloadEnabled =
localStorage.getItem('downloadbtn') === 'true' && !info.offline && !info.photographerURL && api;
const downloadBackground = () => {
if (downloadEnabled) {
@@ -153,7 +141,7 @@ export default function PhotoInformation({ info, url, api }) {
element.style.display = 'none';
}
}
};
};*/
let showingPhotoMap = false;
const photoMap = () => {
@@ -209,7 +197,7 @@ export default function PhotoInformation({ info, url, api }) {
ariaHideApp={false}
onRequestClose={() => openShareModal(false)}
>
<ShareModal data={info.url} modalClose={() => openShareModal(false)} />
<ShareModal data={info.photoURL || info.url} modalClose={() => openShareModal(false)} />
</Modal>
{localStorage.getItem('widgetStyle') === 'legacy' && (
<div className="photoInformation-legacy">

View File

@@ -33,7 +33,11 @@ export default class Navbar extends PureComponent {
this.refreshEnabled = localStorage.getItem('refresh');
this.refreshValue = localStorage.getItem('refreshOption');
this.forceUpdate();
this.setZoom();
try {
this.setZoom();
} catch (e) {
}
}
});
@@ -104,13 +108,6 @@ export default class Navbar extends PureComponent {
</button>
</Tooltip>
</div>
{/*<div className="notification">
<span className="title">New Update</span>
<span className="subtitle">
The newest update includes a lot of cheese plus urmm donate to david ralph on github.
</span>
<button>Learn More</button>
</div>*/}
</div>
);

View File

@@ -71,17 +71,4 @@
right: 1rem;
display: flex;
flex-flow: column;
.notification {
@extend %basic;
display: flex;
flex-flow: column;
gap: 15px;
padding: 15px;
text-align: left;
width: 200px;
button {
@include basicIconButton(10px, 14px, ui);
gap: 20px;
}
}
}