mirror of
https://github.com/mue/mue.git
synced 2026-07-16 05:23:49 +02:00
@@ -5,7 +5,6 @@ import WeatherIcon from './components/WeatherIcon';
|
||||
import Expanded from './components/Expanded';
|
||||
import WeatherSkeleton from './components/WeatherSkeleton';
|
||||
|
||||
|
||||
import EventBus from 'utils/eventbus';
|
||||
|
||||
import { getWeather } from './api/getWeather.js';
|
||||
@@ -44,7 +43,6 @@ class WeatherWidget extends PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
const weatherType = localStorage.getItem('weatherType') || 1;
|
||||
|
||||
if (this.state.done === false) {
|
||||
|
||||
@@ -68,8 +68,11 @@ export const getWeather = async (location, done) => {
|
||||
},
|
||||
done: true,
|
||||
};
|
||||
localStorage.setItem('currentWeather', JSON.stringify({ data: cacheable, cachedAt: Date.now() }));
|
||||
return cacheable
|
||||
localStorage.setItem(
|
||||
'currentWeather',
|
||||
JSON.stringify({ data: cacheable, cachedAt: Date.now() }),
|
||||
);
|
||||
return cacheable;
|
||||
} catch (error) {
|
||||
console.error('Fetch Error: ', error);
|
||||
}
|
||||
|
||||
@@ -10,40 +10,40 @@ function WeatherSkeleton({ weatherType }) {
|
||||
<span className="pulse">20C</span>
|
||||
</div>
|
||||
{weatherType >= 2 && (
|
||||
<span className="minmax">
|
||||
<span className="subtitle pulse">min</span>
|
||||
<span className="subtitle pulse">max</span>
|
||||
</span>
|
||||
<span className="minmax">
|
||||
<span className="subtitle pulse">min</span>
|
||||
<span className="subtitle pulse">max</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{weatherType >= 2 && (
|
||||
<div className="extra-info">
|
||||
<span className="pulse">feels like x</span>
|
||||
<span className="loc pulse">location</span>
|
||||
</div>
|
||||
<div className="extra-info">
|
||||
<span className="pulse">feels like x</span>
|
||||
<span className="loc pulse">location</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{weatherType >= 3 && (
|
||||
<div className="weatherExpandedInfo">
|
||||
<span className="subtitle pulse">extra information</span>
|
||||
<div className="weatherExpandedInfoItems">
|
||||
<div className="infoItemSkeleton">
|
||||
<div className="smallSkeletonIcon pulse"></div>
|
||||
<span className="loc pulse">location</span>
|
||||
</div>
|
||||
<div className="infoItemSkeleton">
|
||||
<div className="smallSkeletonIcon pulse"></div>
|
||||
<span className="loc pulse">location</span>
|
||||
</div>
|
||||
<div className="infoItemSkeleton">
|
||||
<div className="smallSkeletonIcon pulse"></div>
|
||||
<span className="loc pulse">location</span>
|
||||
<div className="weatherExpandedInfo">
|
||||
<span className="subtitle pulse">extra information</span>
|
||||
<div className="weatherExpandedInfoItems">
|
||||
<div className="infoItemSkeleton">
|
||||
<div className="smallSkeletonIcon pulse"></div>
|
||||
<span className="loc pulse">location</span>
|
||||
</div>
|
||||
<div className="infoItemSkeleton">
|
||||
<div className="smallSkeletonIcon pulse"></div>
|
||||
<span className="loc pulse">location</span>
|
||||
</div>
|
||||
<div className="infoItemSkeleton">
|
||||
<div className="smallSkeletonIcon pulse"></div>
|
||||
<span className="loc pulse">location</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default memo(WeatherSkeleton);
|
||||
export default memo(WeatherSkeleton);
|
||||
|
||||
Reference in New Issue
Block a user