Merge branch 'master' into local-dev-docs

This commit is contained in:
Dessalines 2020-06-11 09:50:18 -04:00
commit 80992aa5ba
11 changed files with 49 additions and 22 deletions

2
ansible/VERSION vendored
View file

@ -1 +1 @@
v0.6.71
v0.6.73

View file

@ -12,7 +12,7 @@ services:
restart: always
lemmy:
image: dessalines/lemmy:v0.6.71
image: dessalines/lemmy:v0.6.73
ports:
- "127.0.0.1:8536:8536"
restart: always

View file

@ -1 +1 @@
pub const VERSION: &str = "v0.6.71";
pub const VERSION: &str = "v0.6.73";

View file

@ -111,6 +111,7 @@ export class Login extends Component<any, State> {
required
/>
<button
type="button"
disabled={!validEmail(this.state.loginForm.username_or_email)}
onClick={linkEvent(this, this.handlePasswordReset)}
className="btn p-0 btn-link d-inline-block float-right text-muted small font-weight-bold"

View file

@ -922,7 +922,7 @@ export class User extends Component<any, UserState> {
handleUserSettingsThemeChange(i: User, event: any) {
i.state.userSettingsForm.theme = event.target.value;
setTheme(event.target.value);
setTheme(event.target.value, true);
i.setState(i.state);
}

3
ui/src/index.html vendored
View file

@ -15,7 +15,8 @@
<link rel="stylesheet" type="text/css" href="/static/assets/css/toastify.css" />
<link rel="stylesheet" type="text/css" href="/static/assets/css/selectr.min.css" />
<link rel="stylesheet" type="text/css" href="/static/assets/css/tippy.css" />
<link rel="stylesheet" type="text/css" href="/static/assets/css/themes/darkly.min.css" id="darkly" />
<link rel="stylesheet" type="text/css" href="/static/assets/css/themes/united.min.css" id="default-light" media="(prefers-color-scheme: light)" />
<link rel="stylesheet" type="text/css" href="/static/assets/css/themes/darkly.min.css" id="default-dark" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: dark)" />
<link rel="stylesheet" type="text/css" href="/static/assets/css/main.css" />
<!-- Scripts -->

View file

@ -41,9 +41,7 @@ export class UserService {
private setUser(jwt: string) {
this.user = jwt_decode(jwt);
if (this.user.theme != 'darkly') {
setTheme(this.user.theme);
}
setTheme(this.user.theme, true);
this.sub.next({ user: this.user });
console.log(this.user);
}

22
ui/src/utils.ts vendored
View file

@ -404,7 +404,7 @@ export function getMomentLanguage(): string {
return lang;
}
export function setTheme(theme: string = 'darkly') {
export function setTheme(theme: string = 'darkly', loggedIn: boolean = false) {
// unload all the other themes
for (var i = 0; i < themes.length; i++) {
let styleSheet = document.getElementById(themes[i]);
@ -413,10 +413,19 @@ export function setTheme(theme: string = 'darkly') {
}
}
// Load the theme dynamically
let cssLoc = `/static/assets/css/themes/${theme}.min.css`;
loadCss(theme, cssLoc);
document.getElementById(theme).removeAttribute('disabled');
// if the user is not logged in, we load the default themes and let the browser decide
if(!loggedIn) {
document.getElementById("default-light").removeAttribute('disabled')
document.getElementById("default-dark").removeAttribute('disabled')
} else {
document.getElementById("default-light").setAttribute('disabled', 'disabled');
document.getElementById("default-dark").setAttribute('disabled', 'disabled');
// Load the theme dynamically
let cssLoc = `/static/assets/css/themes/${theme}.min.css`;
loadCss(theme, cssLoc);
document.getElementById(theme).removeAttribute('disabled');
}
}
export function loadCss(id: string, loc: string) {
@ -501,7 +510,7 @@ export function messageToastify(
text: `${body}<br />${creator}`,
avatar: avatar,
backgroundColor: backgroundColor,
className: 'text-body',
className: 'text-dark',
close: true,
gravity: 'top',
position: 'right',
@ -887,7 +896,6 @@ function canUseWebP() {
return false;
// var elem = document.createElement('canvas');
// if (!!(elem.getContext && elem.getContext('2d'))) {
// var testString = !(window.mozInnerScreenX == null) ? 'png' : 'webp';
// // was able or not to get WebP representation

2
ui/src/version.ts vendored
View file

@ -1 +1 @@
export const version: string = 'v0.6.71';
export const version: string = 'v0.6.73';

View file

@ -28,7 +28,7 @@
"community_reqs": "en minuscule, sans espace et avec tiret du bas.",
"create_private_message": "Créer un message privé",
"send_secure_message": "Envoyer le message sécurisé",
"send_message": "Enovyer le message",
"send_message": "Envoyer le message",
"message": "Message",
"edit": "éditer",
"reply": "répondre",
@ -58,14 +58,14 @@
"remove_as_admin": "Supprimer comme admin",
"appoint_as_admin": "Nommer comme admin",
"remove": "retirer",
"removed": "retiré",
"removed": "retiré par le modérateur",
"locked": "bloqué",
"stickied": "épinglé",
"reason": "Raison",
"mark_as_read": "marquer comme lu",
"mark_as_unread": "marquer comme non-lu",
"delete": "supprimer",
"deleted": "supprimé",
"deleted": "supprimé par le créateur",
"delete_account": "Supprimer le compte",
"delete_account_confirm": "Avertissement : cette action supprimera toutes vos données de façons permanente ! Saisissez votre mot de passe pour confirmer.",
"restore": "restaurer",
@ -171,7 +171,7 @@
"theme": "Thème",
"sponsors": "Sponsors",
"sponsors_of_lemmy": "Sponsors de Lemmy",
"sponsor_message": "Lemmy est un logiciel libre et <1>open-source</1>, cest à dire, il fonctionne sans publicité et sans monétisation aucune. Vos dons soutiennent directement le développement du projet à temps plein. Merci à toutes ces personnes :",
"sponsor_message": "Lemmy est un logiciel libre et <1>open-source</1>, sans jamais aucune publicité, ni monétisation ou capital-risque. Vos dons soutiennent directement le développement du projet à temps plein. Merci à toutes ces personnes :",
"support_on_patreon": "Soutenir sur Patreon",
"support_on_liberapay": "Soutenir sur Liberapay",
"donate_to_lemmy": "Faire un don à Lemmy",
@ -251,5 +251,7 @@
"number_of_downvotes_plural": "{{count}} votes contre",
"downvote": "Voter contre",
"emoji_picker": "Sélecteur démojis",
"silver_sponsors": "Les sponsors argent sont ceux et celles qui ont fait une donation de 40$ à Lemmy."
"silver_sponsors": "Les sponsors argent sont ceux et celles qui ont fait une donation de 40$ à Lemmy.",
"select_a_community": "Sélectionner une communauté",
"invalid_username": "Nom d'utilisateur invalide."
}

View file

@ -1 +1,18 @@
{}
{
"post": "Elküld",
"remove_post": "Bejegyzés eltávolítása",
"no_posts": "Nincs bejegyzés.",
"create_post": "Új bejegyzés létrehozása",
"create_a_post": "Új bejegyzés létrehozása",
"number_of_posts": "{{count}} bejegyzés",
"number_of_posts_plural": "{{count}} bejegyzés",
"posts": "Bejegyzések",
"related_posts": "Ezek a bejegyzések kapcsolódhatnak",
"cross_posts": "Ez a hivatkozás itt is be lett küldve:",
"cross_post": "keresztbejegyzés",
"comments": "Hozzászólások",
"remove_comment": "Hozzászólások eltávolítása",
"cross_posted_to": "beküldve ide is: ",
"number_of_comments": "{{count}} hozzászólás",
"number_of_comments_plural": "{{count}} hozzászólás"
}