Skip to content

Commit a32c091

Browse files
authored
Signin modal update. (#1275)
* Started on the signin modal * More signin modal stuff * More signin stuff * Minor changes to the css for the signin modal * Show theme switcher when not logged in * Fixed tests with localStorage and SSR * Fixed the theme switcher stuff for the SSR * Updated strings from crowdin * Convert to functional comnponent
1 parent 2ca4222 commit a32c091

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+554
-433
lines changed

app/pkg/web/testdata/basic.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,26 @@ <h2 class="text-display2">Please enable JavaScript</h2>
5252

5353
<script type="text/javascript" nonce="CONTEXT_ID">
5454
;(function () {
55-
const params = new URLSearchParams(window.location.search)
56-
let theme = "light"
57-
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
58-
theme = params.get("theme")
59-
localStorage.setItem("theme", theme)
60-
params.delete("theme")
61-
const newUrl = `${window.location.pathname}?${params.toString()}`
62-
window.history.replaceState({}, "", newUrl)
63-
} else {
64-
theme = localStorage.getItem("theme") || "light"
65-
}
55+
try {
56+
if (typeof window !== 'undefined' && window.localStorage) {
57+
const params = new URLSearchParams(window.location.search)
58+
let theme = "light"
59+
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
60+
theme = params.get("theme")
61+
localStorage.setItem("theme", theme)
62+
params.delete("theme")
63+
const newUrl = `${window.location.pathname}?${params.toString()}`
64+
window.history.replaceState({}, "", newUrl)
65+
} else {
66+
theme = localStorage.getItem("theme") || "light"
67+
}
6668

67-
if (theme == "light" || theme == "dark") {
68-
document.body.setAttribute("data-theme", theme)
69+
if (theme == "light" || theme == "dark") {
70+
document.body.setAttribute("data-theme", theme)
71+
}
72+
}
73+
} catch (e) {
74+
document.body.setAttribute("data-theme", "light")
6975
}
7076
})()
7177
</script>

app/pkg/web/testdata/canonical.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,26 @@ <h2 class="text-display2">Please enable JavaScript</h2>
5454

5555
<script type="text/javascript" nonce="CONTEXT_ID">
5656
;(function () {
57-
const params = new URLSearchParams(window.location.search)
58-
let theme = "light"
59-
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
60-
theme = params.get("theme")
61-
localStorage.setItem("theme", theme)
62-
params.delete("theme")
63-
const newUrl = `${window.location.pathname}?${params.toString()}`
64-
window.history.replaceState({}, "", newUrl)
65-
} else {
66-
theme = localStorage.getItem("theme") || "light"
67-
}
57+
try {
58+
if (typeof window !== 'undefined' && window.localStorage) {
59+
const params = new URLSearchParams(window.location.search)
60+
let theme = "light"
61+
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
62+
theme = params.get("theme")
63+
localStorage.setItem("theme", theme)
64+
params.delete("theme")
65+
const newUrl = `${window.location.pathname}?${params.toString()}`
66+
window.history.replaceState({}, "", newUrl)
67+
} else {
68+
theme = localStorage.getItem("theme") || "light"
69+
}
6870

69-
if (theme == "light" || theme == "dark") {
70-
document.body.setAttribute("data-theme", theme)
71+
if (theme == "light" || theme == "dark") {
72+
document.body.setAttribute("data-theme", theme)
73+
}
74+
}
75+
} catch (e) {
76+
document.body.setAttribute("data-theme", "light")
7177
}
7278
})()
7379
</script>

app/pkg/web/testdata/chunk.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,26 @@ <h2 class="text-display2">Please enable JavaScript</h2>
5252

5353
<script type="text/javascript" nonce="CONTEXT_ID">
5454
;(function () {
55-
const params = new URLSearchParams(window.location.search)
56-
let theme = "light"
57-
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
58-
theme = params.get("theme")
59-
localStorage.setItem("theme", theme)
60-
params.delete("theme")
61-
const newUrl = `${window.location.pathname}?${params.toString()}`
62-
window.history.replaceState({}, "", newUrl)
63-
} else {
64-
theme = localStorage.getItem("theme") || "light"
65-
}
55+
try {
56+
if (typeof window !== 'undefined' && window.localStorage) {
57+
const params = new URLSearchParams(window.location.search)
58+
let theme = "light"
59+
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
60+
theme = params.get("theme")
61+
localStorage.setItem("theme", theme)
62+
params.delete("theme")
63+
const newUrl = `${window.location.pathname}?${params.toString()}`
64+
window.history.replaceState({}, "", newUrl)
65+
} else {
66+
theme = localStorage.getItem("theme") || "light"
67+
}
6668

67-
if (theme == "light" || theme == "dark") {
68-
document.body.setAttribute("data-theme", theme)
69+
if (theme == "light" || theme == "dark") {
70+
document.body.setAttribute("data-theme", theme)
71+
}
72+
}
73+
} catch (e) {
74+
document.body.setAttribute("data-theme", "light")
6975
}
7076
})()
7177
</script>

app/pkg/web/testdata/home.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,26 @@ <h2 class="text-display2">Please enable JavaScript</h2>
5252

5353
<script type="text/javascript" nonce="CONTEXT_ID">
5454
;(function () {
55-
const params = new URLSearchParams(window.location.search)
56-
let theme = "light"
57-
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
58-
theme = params.get("theme")
59-
localStorage.setItem("theme", theme)
60-
params.delete("theme")
61-
const newUrl = `${window.location.pathname}?${params.toString()}`
62-
window.history.replaceState({}, "", newUrl)
63-
} else {
64-
theme = localStorage.getItem("theme") || "light"
65-
}
55+
try {
56+
if (typeof window !== 'undefined' && window.localStorage) {
57+
const params = new URLSearchParams(window.location.search)
58+
let theme = "light"
59+
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
60+
theme = params.get("theme")
61+
localStorage.setItem("theme", theme)
62+
params.delete("theme")
63+
const newUrl = `${window.location.pathname}?${params.toString()}`
64+
window.history.replaceState({}, "", newUrl)
65+
} else {
66+
theme = localStorage.getItem("theme") || "light"
67+
}
6668

67-
if (theme == "light" || theme == "dark") {
68-
document.body.setAttribute("data-theme", theme)
69+
if (theme == "light" || theme == "dark") {
70+
document.body.setAttribute("data-theme", theme)
71+
}
72+
}
73+
} catch (e) {
74+
document.body.setAttribute("data-theme", "light")
6975
}
7076
})()
7177
</script>

app/pkg/web/testdata/home_ssr.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,26 @@ <h2 class="text-display2">Please enable JavaScript</h2>
5252

5353
<script type="text/javascript" nonce="CONTEXT_ID">
5454
;(function () {
55-
const params = new URLSearchParams(window.location.search)
56-
let theme = "light"
57-
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
58-
theme = params.get("theme")
59-
localStorage.setItem("theme", theme)
60-
params.delete("theme")
61-
const newUrl = `${window.location.pathname}?${params.toString()}`
62-
window.history.replaceState({}, "", newUrl)
63-
} else {
64-
theme = localStorage.getItem("theme") || "light"
65-
}
55+
try {
56+
if (typeof window !== 'undefined' && window.localStorage) {
57+
const params = new URLSearchParams(window.location.search)
58+
let theme = "light"
59+
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
60+
theme = params.get("theme")
61+
localStorage.setItem("theme", theme)
62+
params.delete("theme")
63+
const newUrl = `${window.location.pathname}?${params.toString()}`
64+
window.history.replaceState({}, "", newUrl)
65+
} else {
66+
theme = localStorage.getItem("theme") || "light"
67+
}
6668

67-
if (theme == "light" || theme == "dark") {
68-
document.body.setAttribute("data-theme", theme)
69+
if (theme == "light" || theme == "dark") {
70+
document.body.setAttribute("data-theme", theme)
71+
}
72+
}
73+
} catch (e) {
74+
document.body.setAttribute("data-theme", "light")
6975
}
7076
})()
7177
</script>

app/pkg/web/testdata/oauth.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,26 @@ <h2 class="text-display2">Please enable JavaScript</h2>
5252

5353
<script type="text/javascript" nonce="CONTEXT_ID">
5454
;(function () {
55-
const params = new URLSearchParams(window.location.search)
56-
let theme = "light"
57-
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
58-
theme = params.get("theme")
59-
localStorage.setItem("theme", theme)
60-
params.delete("theme")
61-
const newUrl = `${window.location.pathname}?${params.toString()}`
62-
window.history.replaceState({}, "", newUrl)
63-
} else {
64-
theme = localStorage.getItem("theme") || "light"
65-
}
55+
try {
56+
if (typeof window !== 'undefined' && window.localStorage) {
57+
const params = new URLSearchParams(window.location.search)
58+
let theme = "light"
59+
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
60+
theme = params.get("theme")
61+
localStorage.setItem("theme", theme)
62+
params.delete("theme")
63+
const newUrl = `${window.location.pathname}?${params.toString()}`
64+
window.history.replaceState({}, "", newUrl)
65+
} else {
66+
theme = localStorage.getItem("theme") || "light"
67+
}
6668

67-
if (theme == "light" || theme == "dark") {
68-
document.body.setAttribute("data-theme", theme)
69+
if (theme == "light" || theme == "dark") {
70+
document.body.setAttribute("data-theme", theme)
71+
}
72+
}
73+
} catch (e) {
74+
document.body.setAttribute("data-theme", "light")
6975
}
7076
})()
7177
</script>

app/pkg/web/testdata/tenant.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,26 @@ <h2 class="text-display2">Please enable JavaScript</h2>
5252

5353
<script type="text/javascript" nonce="CONTEXT_ID">
5454
;(function () {
55-
const params = new URLSearchParams(window.location.search)
56-
let theme = "light"
57-
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
58-
theme = params.get("theme")
59-
localStorage.setItem("theme", theme)
60-
params.delete("theme")
61-
const newUrl = `${window.location.pathname}?${params.toString()}`
62-
window.history.replaceState({}, "", newUrl)
63-
} else {
64-
theme = localStorage.getItem("theme") || "light"
65-
}
55+
try {
56+
if (typeof window !== 'undefined' && window.localStorage) {
57+
const params = new URLSearchParams(window.location.search)
58+
let theme = "light"
59+
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
60+
theme = params.get("theme")
61+
localStorage.setItem("theme", theme)
62+
params.delete("theme")
63+
const newUrl = `${window.location.pathname}?${params.toString()}`
64+
window.history.replaceState({}, "", newUrl)
65+
} else {
66+
theme = localStorage.getItem("theme") || "light"
67+
}
6668

67-
if (theme == "light" || theme == "dark") {
68-
document.body.setAttribute("data-theme", theme)
69+
if (theme == "light" || theme == "dark") {
70+
document.body.setAttribute("data-theme", theme)
71+
}
72+
}
73+
} catch (e) {
74+
document.body.setAttribute("data-theme", "light")
6975
}
7076
})()
7177
</script>

app/pkg/web/testdata/user.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,26 @@ <h2 class="text-display2">Please enable JavaScript</h2>
5252

5353
<script type="text/javascript" nonce="CONTEXT_ID">
5454
;(function () {
55-
const params = new URLSearchParams(window.location.search)
56-
let theme = "light"
57-
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
58-
theme = params.get("theme")
59-
localStorage.setItem("theme", theme)
60-
params.delete("theme")
61-
const newUrl = `${window.location.pathname}?${params.toString()}`
62-
window.history.replaceState({}, "", newUrl)
63-
} else {
64-
theme = localStorage.getItem("theme") || "light"
65-
}
55+
try {
56+
if (typeof window !== 'undefined' && window.localStorage) {
57+
const params = new URLSearchParams(window.location.search)
58+
let theme = "light"
59+
if ((params.has("theme") && params.get("theme") === "light") || params.get("theme") === "dark") {
60+
theme = params.get("theme")
61+
localStorage.setItem("theme", theme)
62+
params.delete("theme")
63+
const newUrl = `${window.location.pathname}?${params.toString()}`
64+
window.history.replaceState({}, "", newUrl)
65+
} else {
66+
theme = localStorage.getItem("theme") || "light"
67+
}
6668

67-
if (theme == "light" || theme == "dark") {
68-
document.body.setAttribute("data-theme", theme)
69+
if (theme == "light" || theme == "dark") {
70+
document.body.setAttribute("data-theme", theme)
71+
}
72+
}
73+
} catch (e) {
74+
document.body.setAttribute("data-theme", "light")
6975
}
7076
})()
7177
</script>

locale/ar/client.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181
"label.unsubscribe": "إلغاء الاشتراك",
8282
"label.voters": "المصوتون",
8383
"labels.notagsavailable": "لا توجد وسوم متاحة",
84-
"legal.agreement": "لقد قرأت <0/> و <1/>، وأوافق على ذلك.",
85-
"legal.notice": "بتسجيل الدخول، فإنك توافق على <0/> و <1/>.",
84+
"legal.agreement": "I have read and agree to the <0/> and <1/>.",
85+
"legal.notice": "من خلال تسجيل الدخول، أنت توافق على <2/><0/> و <1/>.",
8686
"legal.privacypolicy": "سياسة الخصوصية",
8787
"legal.termsofservice": "شروط الخدمة",
8888
"menu.administration": "آلإدارة",
@@ -103,7 +103,7 @@
103103
"modal.notifications.unread": "إشعارات غير مقروءة",
104104
"modal.showvotes.message.zeromatches": "لم يتم العثور على مستخدمين مطابقين ل <0>{0}</0>.",
105105
"modal.showvotes.query.placeholder": "البحث عن المستخدمين بالاسم...",
106-
"modal.signin.header": "قم بتسجيل الدخول للمشاركة والتصويت",
106+
"modal.signin.header": "Submit your feedback",
107107
"mynotifications.label.readrecently": "تمت قراءتها خلال آخر 30 يومًا.",
108108
"mynotifications.message.nounread": "لا توجد إشعارات غير مقروءة.",
109109
"mynotifications.page.subtitle": "ابقَ على اطلاع بما يحدث",
@@ -169,13 +169,15 @@
169169
"showpost.responseform.text.placeholder": "ما الذي يجري مع هذا المنشور؟ أخبر المستخدمين ما هي خططك...",
170170
"showpost.votespanel.more": "+{extraVotesCount} أكثر",
171171
"showpost.votespanel.seedetails": "عرض التفاصيل",
172-
"signin.message.email": "أدخل عنوان بريدك الإلكتروني لتسجيل الدخول",
172+
"signin.email.placeholder": "Email address",
173+
"signin.message.email": "Continue with email",
173174
"signin.message.emaildisabled": "تم تعطيل مصادقة البريد الإلكتروني من قبل المسؤول. إذا كان لديك حساب مسؤول وتحتاج إلى تجاوز هذا التقييد، الرجاء <0>انقر هنا </0>.",
174175
"signin.message.emailsent": "لقد أرسلنا للتو رابط تأكيد إلى <0>{email}</0>. انقر فوق الرابط وسوف تسجل دخولك.",
175176
"signin.message.locked.text": "لإعادة تنشيط هذا الموقع، قم بتسجيل الدخول باستخدام حساب مسؤول وتحديث الإعدادات المطلوبة.",
176177
"signin.message.locked.title": "<0>{0}</0> مقفل حاليا.",
177178
"signin.message.onlyadmins": "يسمح حاليا فقط بتسجيل الدخول إلى حساب مسؤول",
178179
"signin.message.private.text": "إذا كان لديك حساب أو دعوت، فيمكنك استخدام الخيارات التالية لتسجيل الدخول.",
179180
"signin.message.private.title": "<0>{0}</0> مساحة خاصة، يجب عليك تسجيل الدخول للمشاركة والتصويت.",
181+
"signin.message.socialbutton.intro": "Log in with",
180182
"{count, plural, one {# tag} other {# tags}}": "{count, plural, zero {}one {# وسم} two {# وسوم} few {# وسوم} many {# وسوم} other {# وسوم}}"
181183
}

locale/cs/client.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181
"label.unsubscribe": "Unsubscribe",
8282
"label.voters": "Voters",
8383
"labels.notagsavailable": "No tags available",
84-
"legal.agreement": "I have read and agree to the <0/> and <1/>.",
85-
"legal.notice": "By signing in, you agree to the <0/> and <1/>.",
84+
"legal.agreement": "Přečetl jsem si a souhlasím s <0/> a <1/>.",
85+
"legal.notice": "Přihlášením souhlasíte s <2/><0/> a <1/>.",
8686
"legal.privacypolicy": "Privacy Policy",
8787
"legal.termsofservice": "Terms of Service",
8888
"menu.administration": "Administration",
@@ -103,7 +103,7 @@
103103
"modal.notifications.unread": "Unread notifications",
104104
"modal.showvotes.message.zeromatches": "No users found matching <0>{0}</0>.",
105105
"modal.showvotes.query.placeholder": "Search for users by name...",
106-
"modal.signin.header": "Sign in to participate and vote",
106+
"modal.signin.header": "Submit your feedback",
107107
"mynotifications.label.readrecently": "Read on last 30 days.",
108108
"mynotifications.message.nounread": "No unread notifications.",
109109
"mynotifications.page.subtitle": "Stay up to date with what's happening",
@@ -169,13 +169,15 @@
169169
"showpost.responseform.text.placeholder": "What's going on with this post? Let your users know what are your plans...",
170170
"showpost.votespanel.more": "+{extraVotesCount} more",
171171
"showpost.votespanel.seedetails": "see details",
172-
"signin.message.email": "Enter your email address to sign in",
172+
"signin.email.placeholder": "Email address",
173+
"signin.message.email": "Continue with email",
173174
"signin.message.emaildisabled": "Email authentication has been disabled by an administrator. If you have an administrator account and need to bypass this restriction, please <0>click here</0>.",
174175
"signin.message.emailsent": "We have just sent a confirmation link to <0>{email}</0>. Click the link and you’ll be signed in.",
175176
"signin.message.locked.text": "To reactivate this site, sign in with an administrator account and update the required settings.",
176177
"signin.message.locked.title": "<0>{0}</0> is currently locked.",
177178
"signin.message.onlyadmins": "Currently only allowed to sign in to an administrator account",
178179
"signin.message.private.text": "If you have an account or an invitation, you may use following options to sign in.",
179180
"signin.message.private.title": "<0>{0}</0> is a private space, you must sign in to participate and vote.",
181+
"signin.message.socialbutton.intro": "Log in with",
180182
"{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"
181183
}

0 commit comments

Comments
 (0)