Fix bug with error when decoding

This commit is contained in:
Fabian Stamm 2020-07-10 18:54:32 +02:00
parent db5a363bff
commit 3c80ac3125
2 changed files with 718 additions and 651 deletions

View File

@ -4,69 +4,76 @@ import Refresh from "feather-icons/dist/icons/refresh-cw.svg";
import "./footer.scss";
import Notifications from "../notifications";
export class Footer extends Component<{}, { synced: boolean, syncing: boolean }> {
constructor(props) {
super(props);
this.state = { synced: false, syncing: false };
this.onSyncedChange = this.onSyncedChange.bind(this);
this.onSyncChange = this.onSyncChange.bind(this);
}
export class Footer extends Component<
{},
{ synced: boolean; syncing: boolean }
> {
constructor(props) {
super(props);
this.state = { synced: false, syncing: false };
this.onSyncedChange = this.onSyncedChange.bind(this);
this.onSyncChange = this.onSyncChange.bind(this);
}
async componentWillMount() {
Notes.syncedObservable.subscribe(this.onSyncedChange);
Notes.syncObservable.subscribe(this.onSyncChange);
this.setState({ synced: await Notes.isSynced() })
}
async componentWillMount() {
Notes.syncedObservable.subscribe(this.onSyncedChange);
Notes.syncObservable.subscribe(this.onSyncChange);
this.setState({ synced: await Notes.isSynced() });
}
componentWillUnmount() {
Notes.syncedObservable.unsubscribe(this.onSyncedChange);
Notes.syncObservable.unsubscribe(this.onSyncChange);
}
componentWillUnmount() {
Notes.syncedObservable.unsubscribe(this.onSyncedChange);
Notes.syncObservable.unsubscribe(this.onSyncChange);
}
onSyncChange(state: boolean) {
console.log("sync", state);
this.setState({ syncing: state })
}
onSyncChange(state: boolean) {
console.log("sync", state);
this.setState({ syncing: state });
}
onSyncedChange(state: boolean) {
console.log("synced", state);
this.setState({ synced: state })
}
onSyncedChange(state: boolean) {
console.log("synced", state);
this.setState({ synced: state });
}
onSyncClick() {
Notes.sync().then(() => {
Notifications.sendInfo("Finished Synchronisation");
})
}
onSyncClick() {
Notes.sync().then(() => {
Notifications.sendInfo("Finished Synchronisation");
});
}
render() {
let extrac = undefined;
let color;
let text;
if (this.state.syncing) {
color = "orange";
text = "syncing";
extrac = "reloading"
} else {
if (this.state.synced) {
color = "green";
text = "synced";
} else {
color = "red";
text = "not synced";
}
}
return <footer class="elv-8">
render() {
let extrac = undefined;
let color;
let text;
if (this.state.syncing) {
color = "orange";
text = "syncing";
extrac = "reloading";
} else {
if (this.state.synced) {
color = "green";
text = "synced";
} else {
color = "red";
text = "not synced";
}
}
return (
<footer class="elv-8">
<span>
<span class={extrac} ><a onClick={() => this.onSyncClick()} ><Refresh style="height: 1em; width: 1em;"></Refresh></a></span>
<span style={"margin-left: 8px; color:" + color}>{text}</span>
<span class={extrac}>
<a onClick={() => this.onSyncClick()}>
<Refresh style="height: 1em; width: 1em;"></Refresh>
</a>
</span>
<span style={"margin-left: 8px; color:" + color}>{text}</span>
</span>
<span>
Welcome <b>{Notes.name}</b>
Welcome <b>{Notes.name}</b>
</span>
<span style="color: lightgrey;">
v1.4
</span>
</footer>
}
}
<span style="color: lightgrey;">v1.5</span>
</footer>
);
}
}

File diff suppressed because it is too large Load Diff