diff --git a/README-zh.md b/README-zh.md index b67902f..345efbc 100644 --- a/README-zh.md +++ b/README-zh.md @@ -20,7 +20,7 @@ ### 下载插件 -下载[最新版本](https://github.com/mixj93/uebersicht-weather-widget/releases/latest)的插件压缩包,解压缩下载的文件并把 `weather.jsx` 放到 Übersicht 的插件文件夹中。 +查看[最新版本](https://github.com/mixj93/uebersicht-weather-widget/releases/latest),下载插件文件 `weather.jsx`,并放到 Übersicht 的插件文件夹中。 ### 配置插件 diff --git a/README.md b/README.md index 3eec439..67a2e9d 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Just downloading from [Übersicht's website](http://tracesof.net/uebersicht/). ### Download Widget -Download the widget zip file check out [the latest release](https://github.com/mixj93/uebersicht-weather-widget/releases/latest), unzip the file and put `Weather.jsx` into Übersicht widgets folder. +Check out [the latest release](https://github.com/mixj93/uebersicht-weather-widget/releases/latest), download the widget file `Weather.jsx` and put into Übersicht widgets folder. ### Configure Widget diff --git a/Weather.jsx b/Weather.jsx index 291eb12..a594f5e 100644 --- a/Weather.jsx +++ b/Weather.jsx @@ -104,7 +104,16 @@ const ICON = { export const command = (dispatch) => { geolocation.getCurrentPosition( (geo) => { - const city = geo.address.city + console.log('🚀 ~ command ~ geo', geo) + const { country, state, city } = geo.address + let address + if (city !== '(null)') { + address = city + } else if (state !== '(null)') { + address = state + } else { + address = country + } const lat = geo.position.coords.latitude const lon = geo.position.coords.longitude const proxy = 'http://127.0.0.1:41417' @@ -121,7 +130,7 @@ export const command = (dispatch) => { return dispatch({ type: 'FETCH_SUCCEDED', data: data, - city: city + city: address }) }) }, diff --git a/Weather.jsx.zip b/Weather.jsx.zip deleted file mode 100644 index 79558d2..0000000 Binary files a/Weather.jsx.zip and /dev/null differ