Merge branch '7.0' of https://github.com/mue/mue into 7.0

This commit is contained in:
David Ralph
2022-08-31 22:05:19 +01:00
12 changed files with 88 additions and 47 deletions

View File

@@ -16,7 +16,7 @@
display: flex; display: flex;
gap: 15px; gap: 15px;
a { a {
@include basicIconButton(11px, 1.5rem, modal); @include basicIconButton(11px, 1.2rem, modal);
} }
} }

View File

@@ -109,7 +109,7 @@ export default class TimeSettings extends PureComponent {
type="color" type="color"
name="hourColour" name="hourColour"
className="minuteColour" className="minuteColour"
onChange={(event) => this.updateColour('hour', event)} onChange={(event) => this.updateColour('hourColour', event)}
value={this.state.hourColour} value={this.state.hourColour}
></input> ></input>
<label htmlFor={'hourColour'} className="customBackgroundHex"> <label htmlFor={'hourColour'} className="customBackgroundHex">
@@ -131,7 +131,7 @@ export default class TimeSettings extends PureComponent {
type="color" type="color"
name="minuteColour" name="minuteColour"
className="minuteColour" className="minuteColour"
onChange={(event) => this.updateColour('minute', event)} onChange={(event) => this.updateColour('minuteColour', event)}
value={this.state.minuteColour} value={this.state.minuteColour}
></input> ></input>
<label htmlFor={'minuteColour'} className="customBackgroundHex"> <label htmlFor={'minuteColour'} className="customBackgroundHex">

View File

@@ -71,7 +71,7 @@ export default class Maximise extends PureComponent {
<Tooltip <Tooltip
title={variables.getMessage('modals.main.settings.sections.background.buttons.view')} title={variables.getMessage('modals.main.settings.sections.background.buttons.view')}
> >
<button> <button style={{ fontSize: this.props.fontSize }}>
<MdCropFree onClick={this.maximise} className="topicons" /> <MdCropFree onClick={this.maximise} className="topicons" />
</button> </button>
</Tooltip> </Tooltip>

View File

@@ -23,8 +23,9 @@ export default class Navbar extends PureComponent {
} }
setZoom() { setZoom() {
const zoomNavbar = Number((localStorage.getItem('zoomNavbar') || 100) / 100); this.setState({
this.navbarContainer.current.style.fontSize = `${zoomNavbar}em`; zoomFontSize: Number(((localStorage.getItem('zoomNavbar') || 100) / 100) * 1.2) + "rem"
})
} }
componentDidMount() { componentDidMount() {
@@ -60,27 +61,19 @@ export default class Navbar extends PureComponent {
const backgroundEnabled = localStorage.getItem('background') === 'true'; const backgroundEnabled = localStorage.getItem('background') === 'true';
const navbar = ( const navbar = (
<div className="navbar-container" ref={this.navbarContainer}> <div className="navbar-container" >
<div className={this.state.classList}> <div className={this.state.classList} >
{localStorage.getItem('view') === 'true' && backgroundEnabled ? <Maximise /> : null} {localStorage.getItem('view') === 'true' && backgroundEnabled ? <Maximise fontSize={this.state.zoomFontSize} /> : null}
{localStorage.getItem('notesEnabled') === 'true' ? <Notes /> : null} {localStorage.getItem('notesEnabled') === 'true' ? <Notes fontSize={this.state.zoomFontSize} /> : null}
{localStorage.getItem('todo') === 'true' ? <Todo /> : null} {localStorage.getItem('todo') === 'true' ? <Todo fontSize={this.state.zoomFontSize} /> : null}
{this.refreshEnabled !== 'false' ? ( {this.refreshEnabled !== 'false' ? (
<Tooltip title={variables.getMessage('widgets.navbar.tooltips.refresh')}> <Tooltip title={variables.getMessage('widgets.navbar.tooltips.refresh')}>
<button onClick={() => this.refresh()}> <button onClick={() => this.refresh()} style={{ fontSize: this.state.zoomFontSize }}>
<MdRefresh className="refreshicon topicons" /> <MdRefresh className="refreshicon topicons" />
</button> </button>
</Tooltip> </Tooltip>
) : null} ) : null}
{/*<InfoTooltip
title="You can now sync your settings"
subtitle={'All settings, such as theme can now be synced across clients'}
linkURL={'https://www.youtube.com/watch?v=dQw4w9WgXcQ'}
linkText={'Learn more'}
>
</InfoTooltip>*/}
<Tooltip <Tooltip
title={variables.getMessage('modals.main.navbar.settings', { title={variables.getMessage('modals.main.navbar.settings', {
type: variables.getMessage( type: variables.getMessage(
@@ -88,7 +81,7 @@ export default class Navbar extends PureComponent {
), ),
})} })}
> >
<button onClick={() => this.props.openModal('mainModal')}> <button onClick={() => this.props.openModal('mainModal')} style={{ fontSize: this.state.zoomFontSize }}>
<MdSettings className="settings-icon topicons" /> <MdSettings className="settings-icon topicons" />
</button> </button>
</Tooltip> </Tooltip>

View File

@@ -6,6 +6,7 @@ import TextareaAutosize from '@mui/material/TextareaAutosize';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import Tooltip from '../../helpers/tooltip/Tooltip'; import Tooltip from '../../helpers/tooltip/Tooltip';
import { saveFile } from 'modules/helpers/settings/modals'; import { saveFile } from 'modules/helpers/settings/modals';
import EventBus from 'modules/helpers/eventbus';
class Notes extends PureComponent { class Notes extends PureComponent {
constructor() { constructor() {
@@ -17,6 +18,25 @@ class Notes extends PureComponent {
}; };
} }
setZoom() {
this.setState({
zoomFontSize: Number(((localStorage.getItem('zoomNavbar') || 100) / 100) * 1.2) + "rem"
})
}
componentDidMount() {
EventBus.on('refresh', (data) => {
if (data === 'navbar' || data === 'background') {
this.forceUpdate();
try {
this.setZoom();
} catch (e) {}
}
});
this.setZoom();
}
setNotes = (e) => { setNotes = (e) => {
localStorage.setItem('notes', e.target.value); localStorage.setItem('notes', e.target.value);
this.setState({ this.setState({
@@ -70,8 +90,9 @@ class Notes extends PureComponent {
onFocus={() => this.showNotes()} onFocus={() => this.showNotes()}
onBlur={() => this.hideNotes()} onBlur={() => this.hideNotes()}
ref={this.props.notesRef} ref={this.props.notesRef}
style={{ fontSize: this.state.zoomFontSize }}
> >
<MdAssignment className="topicons" /> <MdAssignment className="topicons"/>
</button> </button>
{this.state.showNotes && ( {this.state.showNotes && (
<span <span
@@ -119,7 +140,7 @@ class Notes extends PureComponent {
} }
} }
export default function NotesWrapper() { export default function NotesWrapper(props) {
const { x, y, reference, floating, strategy } = useFloating({ const { x, y, reference, floating, strategy } = useFloating({
placement: 'bottom', placement: 'bottom',
middleware: [shift()], middleware: [shift()],

View File

@@ -12,6 +12,7 @@ import Tooltip from '../../helpers/tooltip/Tooltip';
import Checkbox from '@mui/material/Checkbox'; import Checkbox from '@mui/material/Checkbox';
import { shift, useFloating } from '@floating-ui/react-dom'; import { shift, useFloating } from '@floating-ui/react-dom';
import { sortableContainer, sortableElement } from 'react-sortable-hoc'; import { sortableContainer, sortableElement } from 'react-sortable-hoc';
import EventBus from 'modules/helpers/eventbus';
const SortableItem = sortableElement(({ value }) => <div>{value}</div>); const SortableItem = sortableElement(({ value }) => <div>{value}</div>);
const SortableContainer = sortableContainer(({ children }) => <div>{children}</div>); const SortableContainer = sortableContainer(({ children }) => <div>{children}</div>);
@@ -32,6 +33,25 @@ class Todo extends PureComponent {
}; };
} }
setZoom() {
this.setState({
zoomFontSize: Number(((localStorage.getItem('zoomNavbar') || 100) / 100) * 1.2) + "rem"
})
}
componentDidMount() {
EventBus.on('refresh', (data) => {
if (data === 'navbar' || data === 'background') {
this.forceUpdate();
try {
this.setZoom();
} catch (e) {}
}
});
this.setZoom();
}
arrayMove(array, oldIndex, newIndex) { arrayMove(array, oldIndex, newIndex) {
const result = Array.from(array); const result = Array.from(array);
const [removed] = result.splice(oldIndex, 1); const [removed] = result.splice(oldIndex, 1);
@@ -120,6 +140,7 @@ class Todo extends PureComponent {
onFocus={() => this.hideTodo()} onFocus={() => this.hideTodo()}
onBlur={() => this.showTodo()} onBlur={() => this.showTodo()}
ref={this.props.todoRef} ref={this.props.todoRef}
style={{ fontSize: this.state.zoomFontSize }}
> >
<MdChecklist className="topicons" /> <MdChecklist className="topicons" />
</button> </button>

View File

@@ -34,16 +34,16 @@
.old { .old {
.tooltip { .tooltip {
button { button {
@include basicIconButton(12px, 20px, legacy); @include basicIconButton(12px, 1.2rem, legacy);
} }
} }
.first { .first {
@include basicIconButton(12px, 20px, legacy); @include basicIconButton(12px, 1.2rem, legacy);
} }
} }
.new { .new {
button { button {
@include basicIconButton(12px, 20px, ui); @include basicIconButton(12px, 1.2rem, ui);
} }
} }

View File

@@ -56,7 +56,7 @@ h1.quoteauthor {
} }
.author-license { .author-license {
font-size: clamp(8px, 2.5vw, 0.25em); font-size: clamp(8px, 2.5vw, 0.1em);
@include themed() { @include themed() {
color: t($subColor); color: t($subColor);
} }

View File

@@ -10,7 +10,7 @@
@extend %basic; @extend %basic;
outline: none; outline: none;
border: none; border: none;
font-size: 20px; font-size: 1.2rem;
padding: 10px 0 10px 20px; padding: 10px 0 10px 20px;
&::placeholder { &::placeholder {
@@ -40,7 +40,7 @@
flex-flow: column; flex-flow: column;
button { button {
@include basicIconButton(12px, 20px, ui); @include basicIconButton(12px, 1.2rem, ui);
} }
} }

View File

@@ -144,7 +144,7 @@ export default class Weather extends PureComponent {
} }
render() { render() {
const weatherType = localStorage.getItem('weatherType'); const weatherType = localStorage.getItem('weatherType') || 1;
const enabled = (setting) => { const enabled = (setting) => {
return (localStorage.getItem(setting) === 'true' && weatherType >= 3) || weatherType === '3'; return (localStorage.getItem(setting) === 'true' && weatherType >= 3) || weatherType === '3';
}; };
@@ -220,7 +220,7 @@ export default class Weather extends PureComponent {
placement="left" placement="left"
> >
<span> <span>
<WeatherIcon classsName="weatherIcon" name={this.state.icon} /> <WeatherIcon className="weatherIcon" name={this.state.icon} />
{this.state.weather.description} {this.state.weather.description}
</span> </span>
</Tooltip> </Tooltip>
@@ -233,7 +233,7 @@ export default class Weather extends PureComponent {
placement="left" placement="left"
> >
<span> <span>
<MdDisabledVisible style={{ padding: '3px' }} /> <MdDisabledVisible className="materialWeatherIcon" />
{variables.getMessage('widgets.weather.meters', { {variables.getMessage('widgets.weather.meters', {
amount: this.state.weather.visibility, amount: this.state.weather.visibility,
})} })}
@@ -248,8 +248,8 @@ export default class Weather extends PureComponent {
placement="left" placement="left"
> >
<span> <span>
<WiHumidity style={{ padding: '3px' }} /> <WiHumidity className="materialWeatherIcon" />
{this.state.weather.humdity} {this.state.weather.humidity}
</span> </span>
</Tooltip> </Tooltip>
) : null} ) : null}

View File

@@ -17,35 +17,35 @@ export default function WeatherIcon({ name }) {
// name is the openweathermap icon name, see https://openweathermap.org/weather-conditions // name is the openweathermap icon name, see https://openweathermap.org/weather-conditions
switch (name) { switch (name) {
case '01d': case '01d':
return <WiDaySunny />; return <WiDaySunny className="weatherIcon"/>;
case '01n': case '01n':
return <WiNightClear />; return <WiNightClear className="weatherIcon"/>;
case '02d': case '02d':
return <WiDayCloudy />; return <WiDayCloudy className="weatherIcon" />;
case '02n': case '02n':
return <WiNightCloudy />; return <WiNightCloudy className="weatherIcon"/>;
case '03d': case '03d':
case '03n': case '03n':
return <WiCloud />; return <WiCloud className="weatherIcon"/>;
case '04d': case '04d':
case '04n': case '04n':
return <WiCloudy />; return <WiCloudy className="weatherIcon"/>;
case '09d': case '09d':
return <WiDayShowers />; return <WiDayShowers className="weatherIcon"/>;
case '09n': case '09n':
return <WiNightShowers />; return <WiNightShowers className="weatherIcon" />;
case '10d': case '10d':
case '10n': case '10n':
return <WiRain />; return <WiRain className="weatherIcon" />;
case '11d': case '11d':
case '11n': case '11n':
return <WiThunderstorm />; return <WiThunderstorm className="weatherIcon" />;
case '13d': case '13d':
case '13n': case '13n':
return <WiSnow />; return <WiSnow className="weatherIcon" />;
case '50d': case '50d':
case '50n': case '50n':
return <WiFog />; return <WiFog className="weatherIcon" />;
default: default:
return null; return null;
} }

View File

@@ -31,6 +31,7 @@
} }
.extra-info { .extra-info {
width: 100%;
font-size: 18px; font-size: 18px;
gap: 40px; gap: 40px;
@@ -56,6 +57,7 @@
} }
.top-weather { .top-weather {
width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
gap: 25px; gap: 25px;
@@ -99,10 +101,14 @@
} }
.weatherIcon { .weatherIcon {
font-size: 1.4em !important; font-size: 21px !important;
display: grid; display: grid;
align-items: center; align-items: center;
} }
.materialWeatherIcon {
font-size: 18px !important;
padding: 2px;
}
} }
} }