Merge branch 'main' into feat/default-to-user-primary-lang

This commit is contained in:
SleeplessOne1917 2023-06-24 00:53:03 +00:00 committed by GitHub
commit 7cbdfce24c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 24286 additions and 80 deletions

View file

@ -0,0 +1 @@
@import "variables.darkly";

View file

@ -0,0 +1 @@
@import "variables.litely";

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,59 @@
@import "variables.darkly-compact";
/*
GENERAL
*/
// Desktop Breakpoint
$container-max-widths: (
lg: 1920px,
);
// Reduce hr height
hr.my-3 {
margin-top: 0.5rem !important;
margin-bottom: 0.5rem !important;
}
/*
POST-LISTING
*/
.post-listing {
line-height: 1;
.post-title h5 {
margin: 0;
}
.post-title + p {
padding-top: 0.125rem !important;
padding-bottom: 0.125rem !important;
}
.community-link {
padding-left: 0.125rem;
}
.person-listing {
padding-right: 0.125rem;
}
ul.list-inline {
&.mt-2 {
margin-top: 0.125rem !important;
}
&.mb-1 {
margin-bottom: 0.125rem !important;
}
}
.btn-sm {
--bs-btn-padding-y: 0;
}
.img-icon {
display: none;
}
}
@import "../../../../node_modules/bootstrap/scss/bootstrap";

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,59 @@
@import "variables.litely-compact";
/*
GENERAL
*/
// Desktop Breakpoint
$container-max-widths: (
lg: 1920px,
);
// Reduce hr height
hr.my-3 {
margin-top: 0.5rem !important;
margin-bottom: 0.5rem !important;
}
/*
POST-LISTING
*/
.post-listing {
line-height: 1;
.post-title h5 {
margin: 0;
}
.post-title + p {
padding-top: 0.125rem !important;
padding-bottom: 0.125rem !important;
}
.community-link {
padding-left: 0.125rem;
}
.person-listing {
padding-right: 0.125rem;
}
ul.list-inline {
&.mt-2 {
margin-top: 0.125rem !important;
}
&.mb-1 {
margin-bottom: 0.125rem !important;
}
}
.btn-sm {
--bs-btn-padding-y: 0;
}
.img-icon {
display: none;
}
}
@import "../../../../node_modules/bootstrap/scss/bootstrap";

View file

@ -7,8 +7,10 @@ const extraThemesFolder =
const themes: ReadonlyArray<string> = [ const themes: ReadonlyArray<string> = [
"darkly", "darkly",
"darkly-red", "darkly-red",
"darkly-compact",
"litely", "litely",
"litely-red", "litely-red",
"litely-compact",
]; ];
export async function buildThemeList(): Promise<ReadonlyArray<string>> { export async function buildThemeList(): Promise<ReadonlyArray<string>> {

View file

@ -4,7 +4,7 @@ import { Provider } from "inferno-i18next-dess";
import { Route, Switch } from "inferno-router"; import { Route, Switch } from "inferno-router";
import { IsoDataOptionalSite } from "../../interfaces"; import { IsoDataOptionalSite } from "../../interfaces";
import { routes } from "../../routes"; import { routes } from "../../routes";
import { I18NextService } from "../../services"; import { FirstLoadService, I18NextService } from "../../services";
import AuthGuard from "../common/auth-guard"; import AuthGuard from "../common/auth-guard";
import ErrorGuard from "../common/error-guard"; import ErrorGuard from "../common/error-guard";
import { ErrorPage } from "./error-page"; import { ErrorPage } from "./error-page";
@ -45,12 +45,18 @@ export class App extends Component<any, any> {
<Navbar siteRes={siteRes} /> <Navbar siteRes={siteRes} />
<div className="mt-4 p-0 fl-1"> <div className="mt-4 p-0 fl-1">
<Switch> <Switch>
{routes.map(({ path, component: RouteComponent }) => ( {routes.map(
({ path, component: RouteComponent, fetchInitialData }) => (
<Route <Route
key={path} key={path}
path={path} path={path}
exact exact
component={routeProps => ( component={routeProps => {
if (!fetchInitialData) {
FirstLoadService.falsify();
}
return (
<ErrorGuard> <ErrorGuard>
<main tabIndex={-1} ref={this.mainContentRef}> <main tabIndex={-1} ref={this.mainContentRef}>
{RouteComponent && {RouteComponent &&
@ -63,9 +69,11 @@ export class App extends Component<any, any> {
))} ))}
</main> </main>
</ErrorGuard> </ErrorGuard>
)} );
}}
/> />
))} )
)}
<Route component={ErrorPage} /> <Route component={ErrorPage} />
</Switch> </Switch>
</div> </div>

View file

@ -49,13 +49,7 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
return this.props.iconVersion ? ( return this.props.iconVersion ? (
this.selectBtn this.selectBtn
) : ( ) : (
<div className="language-select"> <div className="language-select mb-3">
{this.props.multiple && this.props.showLanguageWarning && (
<div className="alert alert-warning" role="alert">
{I18NextService.i18n.t("undetermined_language_warning")}
</div>
)}
<div className="mb-3 row">
<label <label
className={classNames( className={classNames(
"col-form-label", "col-form-label",
@ -67,6 +61,16 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
this.props.multiple ? "language_plural" : "language" this.props.multiple ? "language_plural" : "language"
)} )}
</label> </label>
{this.props.multiple && this.props.showLanguageWarning && (
<div
id="lang-warning"
className="alert small alert-warning"
role="alert"
>
<Icon icon="alert-triangle" classes="icon-inline me-2" />
{I18NextService.i18n.t("undetermined_language_warning")}
</div>
)}
<div <div
className={classNames(`col-sm-${this.props.multiple ? 9 : 10}`, { className={classNames(`col-sm-${this.props.multiple ? 9 : 10}`, {
"input-group": this.props.multiple, "input-group": this.props.multiple,
@ -83,7 +87,6 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
)} )}
</div> </div>
</div> </div>
</div>
); );
} }
@ -105,6 +108,11 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
id={this.id} id={this.id}
onChange={linkEvent(this, this.handleLanguageChange)} onChange={linkEvent(this, this.handleLanguageChange)}
aria-label={I18NextService.i18n.t("language_select_placeholder")} aria-label={I18NextService.i18n.t("language_select_placeholder")}
aria-describedby={
this.props.multiple && this.props.showLanguageWarning
? "lang-warning"
: ""
}
multiple={this.props.multiple} multiple={this.props.multiple}
disabled={this.props.disabled} disabled={this.props.disabled}
> >

View file

@ -4,7 +4,7 @@ import {
CreateCommunity as CreateCommunityI, CreateCommunity as CreateCommunityI,
GetSiteResponse, GetSiteResponse,
} from "lemmy-js-client"; } from "lemmy-js-client";
import { FirstLoadService, HttpService, I18NextService } from "../../services"; import { HttpService, I18NextService } from "../../services";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
import { CommunityForm } from "./community-form"; import { CommunityForm } from "./community-form";
@ -22,8 +22,6 @@ export class CreateCommunity extends Component<any, CreateCommunityState> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
this.handleCommunityCreate = this.handleCommunityCreate.bind(this); this.handleCommunityCreate = this.handleCommunityCreate.bind(this);
FirstLoadService.isFirstLoad;
} }
get documentTitle(): string { get documentTitle(): string {

View file

@ -2,7 +2,7 @@ import { setIsoData } from "@utils/app";
import { Component } from "inferno"; import { Component } from "inferno";
import { GetSiteResponse } from "lemmy-js-client"; import { GetSiteResponse } from "lemmy-js-client";
import { mdToHtml } from "../../markdown"; import { mdToHtml } from "../../markdown";
import { FirstLoadService, I18NextService } from "../../services"; import { I18NextService } from "../../services";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
interface LegalState { interface LegalState {
@ -17,8 +17,6 @@ export class Legal extends Component<any, LegalState> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
FirstLoadService.isFirstLoad;
} }
get documentTitle(): string { get documentTitle(): string {

View file

@ -3,7 +3,7 @@ import { isBrowser } from "@utils/browser";
import { validEmail } from "@utils/helpers"; import { validEmail } from "@utils/helpers";
import { Component, linkEvent } from "inferno"; import { Component, linkEvent } from "inferno";
import { GetSiteResponse, LoginResponse } from "lemmy-js-client"; import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
import { FirstLoadService, I18NextService, UserService } from "../../services"; import { I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast"; import { toast } from "../../toast";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
@ -32,8 +32,6 @@ export class Login extends Component<any, State> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
FirstLoadService.isFirstLoad;
} }
componentDidMount() { componentDidMount() {

View file

@ -7,7 +7,7 @@ import {
LoginResponse, LoginResponse,
Register, Register,
} from "lemmy-js-client"; } from "lemmy-js-client";
import { FirstLoadService, I18NextService, UserService } from "../../services"; import { I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { Spinner } from "../common/icon"; import { Spinner } from "../common/icon";
import { SiteForm } from "./site-form"; import { SiteForm } from "./site-form";
@ -47,8 +47,6 @@ export class Setup extends Component<any, State> {
super(props, context); super(props, context);
this.handleCreateSite = this.handleCreateSite.bind(this); this.handleCreateSite = this.handleCreateSite.bind(this);
FirstLoadService.isFirstLoad;
} }
async componentDidMount() { async componentDidMount() {

View file

@ -14,7 +14,7 @@ import {
} from "lemmy-js-client"; } from "lemmy-js-client";
import { joinLemmyUrl } from "../../config"; import { joinLemmyUrl } from "../../config";
import { mdToHtml } from "../../markdown"; import { mdToHtml } from "../../markdown";
import { FirstLoadService, I18NextService, UserService } from "../../services"; import { I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast"; import { toast } from "../../toast";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
@ -84,8 +84,6 @@ export class Signup extends Component<any, State> {
super(props, context); super(props, context);
this.handleAnswerChange = this.handleAnswerChange.bind(this); this.handleAnswerChange = this.handleAnswerChange.bind(this);
FirstLoadService.isFirstLoad;
} }
async componentDidMount() { async componentDidMount() {

View file

@ -2,12 +2,7 @@ import { myAuth, setIsoData } from "@utils/app";
import { capitalizeFirstLetter } from "@utils/helpers"; import { capitalizeFirstLetter } from "@utils/helpers";
import { Component, linkEvent } from "inferno"; import { Component, linkEvent } from "inferno";
import { GetSiteResponse, LoginResponse } from "lemmy-js-client"; import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
import { import { HttpService, I18NextService, UserService } from "../../services";
FirstLoadService,
HttpService,
I18NextService,
UserService,
} from "../../services";
import { RequestState } from "../../services/HttpService"; import { RequestState } from "../../services/HttpService";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
import { Spinner } from "../common/icon"; import { Spinner } from "../common/icon";
@ -35,8 +30,6 @@ export class PasswordChange extends Component<any, State> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
FirstLoadService.isFirstLoad;
} }
get documentTitle(): string { get documentTitle(): string {

View file

@ -29,7 +29,7 @@ import {
SortType, SortType,
} from "lemmy-js-client"; } from "lemmy-js-client";
import { elementUrl, emDash, relTags } from "../../config"; import { elementUrl, emDash, relTags } from "../../config";
import { FirstLoadService, UserService } from "../../services"; import { UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { I18NextService, languages } from "../../services/I18NextService"; import { I18NextService, languages } from "../../services/I18NextService";
import { setupTippy } from "../../tippy"; import { setupTippy } from "../../tippy";
@ -170,8 +170,6 @@ export class Settings extends Component<any, SettingsState> {
this.handleBlockPerson = this.handleBlockPerson.bind(this); this.handleBlockPerson = this.handleBlockPerson.bind(this);
this.handleBlockCommunity = this.handleBlockCommunity.bind(this); this.handleBlockCommunity = this.handleBlockCommunity.bind(this);
FirstLoadService.isFirstLoad;
const mui = UserService.Instance.myUserInfo; const mui = UserService.Instance.myUserInfo;
if (mui) { if (mui) {
const { const {

View file

@ -1,7 +1,7 @@
import { setIsoData } from "@utils/app"; import { setIsoData } from "@utils/app";
import { Component } from "inferno"; import { Component } from "inferno";
import { GetSiteResponse, VerifyEmailResponse } from "lemmy-js-client"; import { GetSiteResponse, VerifyEmailResponse } from "lemmy-js-client";
import { FirstLoadService, I18NextService } from "../../services"; import { I18NextService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast"; import { toast } from "../../toast";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
@ -22,8 +22,6 @@ export class VerifyEmail extends Component<any, State> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
FirstLoadService.isFirstLoad;
} }
async verify() { async verify() {

View file

@ -17,6 +17,10 @@ export class FirstLoadService {
return isFirst; return isFirst;
} }
falsify() {
this.#isFirstLoad = false;
}
static get #Instance() { static get #Instance() {
return this.#instance ?? (this.#instance = new this()); return this.#instance ?? (this.#instance = new this());
} }
@ -24,4 +28,8 @@ export class FirstLoadService {
static get isFirstLoad() { static get isFirstLoad() {
return !isBrowser() || this.#Instance.isFirstLoad; return !isBrowser() || this.#Instance.isFirstLoad;
} }
static falsify() {
this.#Instance.falsify();
}
} }