mirror of
https://github.com/mastodon/mastodon.git
synced 2025-12-12 21:12:42 +00:00
Some checks failed
Check i18n / check-i18n (push) Has been cancelled
Chromatic / Check for relevant changes (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Crowdin / Upload translations / upload-translations (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
CSS Linting / lint (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
JavaScript Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
JavaScript Testing / test (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Historical data migration test / test (16-alpine) (push) Has been cancelled
Historical data migration test / test (17-alpine) (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Chromatic / Run Chromatic (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / test (3.3) (push) Has been cancelled
Ruby Testing / ImageMagick tests (.ruby-version) (push) Has been cancelled
Ruby Testing / ImageMagick tests (3.2) (push) Has been cancelled
Ruby Testing / ImageMagick tests (3.3) (push) Has been cancelled
Ruby Testing / End to End testing (.ruby-version) (push) Has been cancelled
Ruby Testing / End to End testing (3.2) (push) Has been cancelled
Ruby Testing / End to End testing (3.3) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { createRoot } from 'react-dom/client';
|
|
|
|
import { Provider as ReduxProvider } from 'react-redux';
|
|
|
|
import { importFetchedStatuses } from '@/mastodon/actions/importer';
|
|
import { hydrateStore } from '@/mastodon/actions/store';
|
|
import type { ApiAnnualReportResponse } from '@/mastodon/api/annual_report';
|
|
import { Router } from '@/mastodon/components/router';
|
|
import { WrapstodonSharedPage } from '@/mastodon/features/annual_report/shared_page';
|
|
import { IntlProvider, loadLocale } from '@/mastodon/locales';
|
|
import { loadPolyfills } from '@/mastodon/polyfills';
|
|
import ready from '@/mastodon/ready';
|
|
import { setReport } from '@/mastodon/reducers/slices/annual_report';
|
|
import { store } from '@/mastodon/store';
|
|
|
|
function loaded() {
|
|
const mountNode = document.getElementById('wrapstodon');
|
|
if (!mountNode) {
|
|
throw new Error('Mount node not found');
|
|
}
|
|
const propsNode = document.getElementById('wrapstodon-data');
|
|
if (!propsNode) {
|
|
throw new Error('Initial state prop not found');
|
|
}
|
|
|
|
const initialState = JSON.parse(
|
|
propsNode.textContent,
|
|
) as ApiAnnualReportResponse;
|
|
|
|
const report = initialState.annual_reports[0];
|
|
if (!report) {
|
|
throw new Error('Initial state report not found');
|
|
}
|
|
|
|
// Set up store
|
|
store.dispatch(
|
|
hydrateStore({
|
|
meta: { locale: document.documentElement.lang },
|
|
accounts: initialState.accounts,
|
|
}),
|
|
);
|
|
store.dispatch(importFetchedStatuses(initialState.statuses));
|
|
|
|
store.dispatch(setReport(report));
|
|
|
|
const root = createRoot(mountNode);
|
|
root.render(
|
|
<IntlProvider>
|
|
<ReduxProvider store={store}>
|
|
<Router>
|
|
<WrapstodonSharedPage />
|
|
</Router>
|
|
</ReduxProvider>
|
|
</IntlProvider>,
|
|
);
|
|
}
|
|
|
|
loadPolyfills()
|
|
.then(loadLocale)
|
|
.then(() => ready(loaded))
|
|
.catch((err: unknown) => {
|
|
console.error(err);
|
|
});
|