fix: broken marketplace tags, remove obsolete functions

This commit is contained in:
David Ralph 2024-01-01 12:02:14 +00:00
parent 2ba9714cad
commit c29376f715
3 changed files with 15 additions and 38 deletions

View File

@ -83,13 +83,7 @@ function Items({
</span>
{type === 'all' && !onCollection ? (
<span className="card-type">
{variables.getMessage(
`modals.main.addons.create.types.${
item.type.split('_')[0] === 'preset'
? 'settings'
: item.type.split('_')[0] + 's'
}`,
)}
{variables.getMessage('modals.main.marketplace.' + item.type)}
</span>
) : null}
</div>

View File

@ -23,7 +23,6 @@ class Marketplace extends PureComponent {
this.state = {
items: [],
button: '',
featured: {},
done: false,
item: {},
collection: false,
@ -139,11 +138,6 @@ class Marketplace extends PureComponent {
signal: this.controller.signal,
})
).json();
const featured = await (
await fetch(variables.constants.MARKETPLACE_URL + '/featured', {
signal: this.controller.signal,
})
).json();
const collections = await (
await fetch(variables.constants.MARKETPLACE_URL + '/collections', {
signal: this.controller.signal,
@ -157,7 +151,6 @@ class Marketplace extends PureComponent {
this.setState({
items: data,
oldItems: data,
featured: featured.data,
collections: collections.data,
done: true,
});
@ -284,10 +277,10 @@ class Marketplace extends PureComponent {
return errorMessage(
<>
<MdWifiOff />
<h1>{variables.getMessage('modals.main.marketplace.offline.title')}</h1>
<p className="description">
<span className="title">{variables.getMessage('modals.main.marketplace.offline.title')}</span>
<span className="subtitle">
{variables.getMessage('modals.main.marketplace.offline.description')}
</p>
</span>
</>,
);
}
@ -303,34 +296,16 @@ class Marketplace extends PureComponent {
);
}
const featured = () => {
const openFeatured = () => {
variables.stats.postEvent('marketplace', 'Featured clicked');
window.open(this.state.featured.buttonLink);
};
return (
<div className="featured" style={{ backgroundColor: this.state.featured.colour }}>
<p>{this.state.featured.title}</p>
<h1>{this.state.featured.name}</h1>
<button className="addToMue" onClick={() => openFeatured()}>
{this.state.featured.buttonText}
</button>
</div>
);
};
if (this.state.items?.length === 0) {
return (
<>
{featured()}
{errorMessage(
<>
<MdLocalMall />
<h1>{variables.getMessage('modals.main.addons.empty.title')}</h1>
<p className="description">
<span className="title">{variables.getMessage('modals.main.addons.empty.title')}</span>
<span className="subtitle">
{variables.getMessage('modals.main.marketplace.no_items')}
</p>
</span>
</>,
)}
</>

View File

@ -255,6 +255,14 @@
grid-gap: 5px;
padding: 50px;
.title, svg {
margin: 10px;
}
svg {
font-size: 70px;
}
@include themed {
.sideloadIcon {
font-size: 50px;