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 restart: always
lemmy: lemmy:
image: dessalines/lemmy:v0.6.71 image: dessalines/lemmy:v0.6.73
ports: ports:
- "127.0.0.1:8536:8536" - "127.0.0.1:8536:8536"
restart: always 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 required
/> />
<button <button
type="button"
disabled={!validEmail(this.state.loginForm.username_or_email)} disabled={!validEmail(this.state.loginForm.username_or_email)}
onClick={linkEvent(this, this.handlePasswordReset)} onClick={linkEvent(this, this.handlePasswordReset)}
className="btn p-0 btn-link d-inline-block float-right text-muted small font-weight-bold" 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) { handleUserSettingsThemeChange(i: User, event: any) {
i.state.userSettingsForm.theme = event.target.value; i.state.userSettingsForm.theme = event.target.value;
setTheme(event.target.value); setTheme(event.target.value, true);
i.setState(i.state); 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/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/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/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" /> <link rel="stylesheet" type="text/css" href="/static/assets/css/main.css" />
<!-- Scripts --> <!-- Scripts -->

View File

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

14
ui/src/utils.ts vendored
View File

@ -404,7 +404,7 @@ export function getMomentLanguage(): string {
return lang; return lang;
} }
export function setTheme(theme: string = 'darkly') { export function setTheme(theme: string = 'darkly', loggedIn: boolean = false) {
// unload all the other themes // unload all the other themes
for (var i = 0; i < themes.length; i++) { for (var i = 0; i < themes.length; i++) {
let styleSheet = document.getElementById(themes[i]); let styleSheet = document.getElementById(themes[i]);
@ -413,10 +413,19 @@ export function setTheme(theme: string = 'darkly') {
} }
} }
// 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 // Load the theme dynamically
let cssLoc = `/static/assets/css/themes/${theme}.min.css`; let cssLoc = `/static/assets/css/themes/${theme}.min.css`;
loadCss(theme, cssLoc); loadCss(theme, cssLoc);
document.getElementById(theme).removeAttribute('disabled'); document.getElementById(theme).removeAttribute('disabled');
}
} }
export function loadCss(id: string, loc: string) { export function loadCss(id: string, loc: string) {
@ -501,7 +510,7 @@ export function messageToastify(
text: `${body}<br />${creator}`, text: `${body}<br />${creator}`,
avatar: avatar, avatar: avatar,
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
className: 'text-body', className: 'text-dark',
close: true, close: true,
gravity: 'top', gravity: 'top',
position: 'right', position: 'right',
@ -887,7 +896,6 @@ function canUseWebP() {
return false; return false;
// var elem = document.createElement('canvas'); // var elem = document.createElement('canvas');
// if (!!(elem.getContext && elem.getContext('2d'))) { // if (!!(elem.getContext && elem.getContext('2d'))) {
// var testString = !(window.mozInnerScreenX == null) ? 'png' : 'webp'; // var testString = !(window.mozInnerScreenX == null) ? 'png' : 'webp';
// // was able or not to get WebP representation // // 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.", "community_reqs": "en minuscule, sans espace et avec tiret du bas.",
"create_private_message": "Créer un message privé", "create_private_message": "Créer un message privé",
"send_secure_message": "Envoyer le message sécurisé", "send_secure_message": "Envoyer le message sécurisé",
"send_message": "Enovyer le message", "send_message": "Envoyer le message",
"message": "Message", "message": "Message",
"edit": "éditer", "edit": "éditer",
"reply": "répondre", "reply": "répondre",
@ -58,14 +58,14 @@
"remove_as_admin": "Supprimer comme admin", "remove_as_admin": "Supprimer comme admin",
"appoint_as_admin": "Nommer comme admin", "appoint_as_admin": "Nommer comme admin",
"remove": "retirer", "remove": "retirer",
"removed": "retiré", "removed": "retiré par le modérateur",
"locked": "bloqué", "locked": "bloqué",
"stickied": "épinglé", "stickied": "épinglé",
"reason": "Raison", "reason": "Raison",
"mark_as_read": "marquer comme lu", "mark_as_read": "marquer comme lu",
"mark_as_unread": "marquer comme non-lu", "mark_as_unread": "marquer comme non-lu",
"delete": "supprimer", "delete": "supprimer",
"deleted": "supprimé", "deleted": "supprimé par le créateur",
"delete_account": "Supprimer le compte", "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.", "delete_account_confirm": "Avertissement : cette action supprimera toutes vos données de façons permanente ! Saisissez votre mot de passe pour confirmer.",
"restore": "restaurer", "restore": "restaurer",
@ -171,7 +171,7 @@
"theme": "Thème", "theme": "Thème",
"sponsors": "Sponsors", "sponsors": "Sponsors",
"sponsors_of_lemmy": "Sponsors de Lemmy", "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_patreon": "Soutenir sur Patreon",
"support_on_liberapay": "Soutenir sur Liberapay", "support_on_liberapay": "Soutenir sur Liberapay",
"donate_to_lemmy": "Faire un don à Lemmy", "donate_to_lemmy": "Faire un don à Lemmy",
@ -251,5 +251,7 @@
"number_of_downvotes_plural": "{{count}} votes contre", "number_of_downvotes_plural": "{{count}} votes contre",
"downvote": "Voter contre", "downvote": "Voter contre",
"emoji_picker": "Sélecteur démojis", "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"
}