2022-03-05 13:10:45 +00:00
|
|
|
import {html} from 'htm/preact';
|
|
|
|
import {Component, render} from 'preact';
|
|
|
|
|
|
|
|
import {Settings} from '../settings/settings.js';
|
2022-03-14 22:58:05 +00:00
|
|
|
import {updateBadge} from '../utilities/badge.js';
|
2022-03-05 13:10:45 +00:00
|
|
|
import {History} from '../utilities/history.js';
|
|
|
|
import {PageFooter, PageHeader, PageMain} from './components/components.js';
|
|
|
|
|
|
|
|
window.addEventListener('DOMContentLoaded', async () => {
|
|
|
|
const history = await History.fromLocalStorage();
|
|
|
|
const settings = await Settings.fromSyncStorage();
|
2022-03-14 22:58:05 +00:00
|
|
|
await updateBadge(settings);
|
2022-03-05 13:10:45 +00:00
|
|
|
|
|
|
|
render(
|
|
|
|
html`<${OptionsPage} history=${history} settings=${settings} />`,
|
|
|
|
document.body,
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
history: Queue.Item[];
|
|
|
|
settings: Settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
class OptionsPage extends Component<Props> {
|
|
|
|
render() {
|
|
|
|
const {history, settings} = this.props;
|
|
|
|
|
|
|
|
return html`
|
|
|
|
<${PageHeader} />
|
|
|
|
<${PageMain} history=${history} settings=${settings} />
|
|
|
|
<${PageFooter} settings=${settings} />
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|