mirror of https://github.com/mue/mue.git
fix(quicklinks): Fix options, rename weather api file
This commit is contained in:
parent
7e78465406
commit
ebe0784e8d
|
@ -0,0 +1,68 @@
|
|||
import variables from 'config/variables';
|
||||
|
||||
import { MdEdit, MdCancel } from 'react-icons/md';
|
||||
|
||||
const QuickLink = ({ item, deleteLink, startEditLink }) => {
|
||||
let target,
|
||||
rel = null;
|
||||
if (localStorage.getItem('quicklinksnewtab') === 'true') {
|
||||
target = '_blank';
|
||||
rel = 'noopener noreferrer';
|
||||
}
|
||||
|
||||
const useText = localStorage.getItem('quicklinksText') === 'true';
|
||||
|
||||
if (useText) {
|
||||
return (
|
||||
<a
|
||||
className="quicklinkstext"
|
||||
onContextMenu={(e) => deleteLink(item.key, e)}
|
||||
href={item.url}
|
||||
target={target}
|
||||
rel={rel}
|
||||
draggable={false}
|
||||
>
|
||||
{item.name}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
const img =
|
||||
item.icon ||
|
||||
'https://icon.horse/icon/ ' + item.url.replace('https://', '').replace('http://', '');
|
||||
|
||||
return (
|
||||
<div className="messageMap">
|
||||
<div className="icon">
|
||||
<img
|
||||
src={img}
|
||||
alt={item.name}
|
||||
draggable={false}
|
||||
style={{ height: '30px', width: '30px' }}
|
||||
/>
|
||||
</div>
|
||||
<div className="messageText">
|
||||
<div className="title">{item.name}</div>
|
||||
<div className="subtitle">
|
||||
<a className="quicklinknostyle" target="_blank" rel="noopener noreferrer" href={item.url}>
|
||||
{item.url}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="messageAction">
|
||||
<button className="deleteButton" onClick={() => startEditLink(item)}>
|
||||
{variables.getMessage('modals.main.settings.sections.quicklinks.edit')}
|
||||
<MdEdit />
|
||||
</button>
|
||||
<button className="deleteButton" onClick={(e) => deleteLink(item.key, e)}>
|
||||
{variables.getMessage('modals.main.marketplace.product.buttons.remove')}
|
||||
<MdCancel />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { QuickLink as default, QuickLink };
|
|
@ -9,7 +9,7 @@ import Modal from 'react-modal';
|
|||
import { AddModal } from 'components/Elements/AddModal';
|
||||
|
||||
import EventBus from 'utils/eventbus';
|
||||
import { QuickLink } from '../QuickLinks';
|
||||
import { QuickLink } from './QuickLink';
|
||||
import { getTitleFromUrl, isValidUrl } from 'utils/links';
|
||||
|
||||
class QuickLinksOptions extends PureComponent {
|
||||
|
@ -272,4 +272,4 @@ class QuickLinksOptions extends PureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
export { QuickLinksOptions as default, QuickLinksOptions };
|
||||
export { QuickLinksOptions as default, QuickLinksOptions };
|
||||
|
|
|
@ -6,7 +6,7 @@ import Expanded from './components/Expanded';
|
|||
|
||||
import EventBus from 'utils/eventbus';
|
||||
|
||||
import { getWeather } from './api/WeatherAPI.js';
|
||||
import { getWeather } from './api/getWeather.js';
|
||||
|
||||
import './weather.scss';
|
||||
|
||||
|
@ -53,6 +53,7 @@ class WeatherWidget extends PureComponent {
|
|||
|
||||
return (
|
||||
<div className="weather">
|
||||
{this.state.done === false ? <h1>cheese</h1> : <h1>loading finished</h1>}
|
||||
<div className="weatherCore">
|
||||
<div className="iconAndTemps">
|
||||
<div className="weathericon">
|
||||
|
|
Loading…
Reference in New Issue