import { CreateSite, EditSite, Site } from "lemmy-js-client";
import { i18n } from "../../i18next";
import { WebSocketService } from "../../services";
-import { authField, capitalizeFirstLetter, wsClient } from "../../utils";
+import {
+ authField,
+ capitalizeFirstLetter,
+ themes,
+ wsClient,
+} from "../../utils";
import { Spinner } from "../common/icon";
import { ImageUploadForm } from "../common/image-upload-form";
import { MarkdownTextArea } from "../common/markdown-textarea";
require_application: null,
application_question: null,
private_instance: null,
+ default_theme: null,
auth: authField(),
},
loading: false,
require_application: site.require_application,
application_question: site.application_question,
private_instance: site.private_instance,
+ default_theme: site.default_theme,
auth: authField(),
};
}
</div>
</div>
</div>
+ <div class="form-group row">
+ <div class="col-12">
+ <label
+ class="form-check-label mr-2"
+ htmlFor="create-site-default-theme"
+ >
+ {i18n.t("theme")}
+ </label>
+ <select
+ id="create-site-default-theme"
+ value={this.state.siteForm.default_theme}
+ onChange={linkEvent(this, this.handleSiteDefaultTheme)}
+ class="custom-select w-auto"
+ >
+ <option value="browser">{i18n.t("browser_default")}</option>
+ {themes.map(theme => (
+ <option value={theme}>{theme}</option>
+ ))}
+ </select>
+ </div>
+ </div>
<div class="form-group row">
<div class="col-12">
<div class="form-check">
class="form-check-input"
id="create-site-private-instance"
type="checkbox"
- checked={this.state.siteForm.private_instance}
+ value={this.state.siteForm.default_theme}
onChange={linkEvent(this, this.handleSitePrivateInstance)}
/>
<label
i.setState(i.state);
}
+ handleSiteDefaultTheme(i: SiteForm, event: any) {
+ i.state.siteForm.default_theme = event.target.value;
+ i.setState(i.state);
+ }
+
handleCancel(i: SiteForm) {
i.props.onCancel();
}