Skip to content

Commit

Permalink
feat(webapp): migrate from @mdi/font to @mdi/js
Browse files Browse the repository at this point in the history
Use tree shakeable version instead of big webfont.
  • Loading branch information
Rotzbua committed Jan 10, 2024
1 parent 8ce07b2 commit 82814f8
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 24 deletions.
1 change: 0 additions & 1 deletion www/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"dependencies": {
"@fontsource/roboto": "^5.0.3",
"@mdi/font": "^7.2.96",
"@mdi/js": "~7.3.67",
"axios": "^1.4.0",
"date-fns": "^2.30.0",
Expand Down
14 changes: 10 additions & 4 deletions www/webapp/src/components/ActivateAccountActionHandler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<v-text-field
v-model="payload.captcha.solution"
label="Type CAPTCHA text here"
prepend-icon="mdi-account-check"
:prepend-icon="mdiAccountCheck"
outlined
required
:disabled="working"
Expand Down Expand Up @@ -38,12 +38,12 @@
</audio>
<br/>
<v-btn-toggle>
<v-btn text outlined @click="getCaptcha(true)" :disabled="captchaWorking"><v-icon>mdi-refresh</v-icon></v-btn>
<v-btn text outlined @click="getCaptcha(true)" :disabled="captchaWorking"><v-icon>{{ mdiRefresh }}</v-icon></v-btn>
</v-btn-toggle>
&nbsp;
<v-btn-toggle v-model="captcha_kind">
<v-btn text outlined value="image" aria-label="Switch to Image CAPTCHA" :disabled="captchaWorking"><v-icon>mdi-eye</v-icon></v-btn>
<v-btn text outlined value="audio" aria-label="Switch to Audio CAPTCHA" :disabled="captchaWorking"><v-icon>mdi-ear-hearing</v-icon></v-btn>
<v-btn text outlined value="image" aria-label="Switch to Image CAPTCHA" :disabled="captchaWorking"><v-icon>{{ mdiEye }}</v-icon></v-btn>
<v-btn text outlined value="audio" aria-label="Switch to Audio CAPTCHA" :disabled="captchaWorking"><v-icon>{{ mdiEarHearing }}</v-icon></v-btn>
</v-btn-toggle>
</v-col>
</v-row>
Expand All @@ -66,6 +66,7 @@
<script>
import axios from 'axios';
import GenericActionHandler from "./GenericActionHandler.vue"
import {mdiAccountCheck, mdiEarHearing, mdiEye, mdiRefresh} from "@mdi/js";
const HTTP = axios.create({
baseURL: '/api/v1/',
Expand All @@ -82,6 +83,11 @@
captcha: null,
captcha_required: false,
mdiAccountCheck: mdiAccountCheck,
mdiEarHearing: mdiEarHearing,
mdiEye: mdiEye,
mdiRefresh: mdiRefresh,
/* captcha field */
captchaSolution: '',
captcha_rules: [v => !!v || 'Please enter the text displayed in the picture so we are (somewhat) convinced you are human'],
Expand Down
5 changes: 4 additions & 1 deletion www/webapp/src/components/ResetPasswordActionHandler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="text-center" v-if="!success">
<v-text-field
v-model="payload.new_password"
:append-icon="show ? 'mdi-eye' : 'mdi-eye-off'"
:append-icon="show ? mdiEyeOff : mdiEye"
label="New password"
required
:disabled="working"
Expand Down Expand Up @@ -31,11 +31,14 @@

<script>
import GenericActionHandler from "./GenericActionHandler.vue"
import {mdiEye, mdiEyeOff} from "@mdi/js";
export default {
name: 'ResetPasswordActionHandler',
extends: GenericActionHandler,
data: () => ({
mdiEyeOff: mdiEyeOff,
mdiEye: mdiEye,
rules: {
required: value => !!value || 'Required.',
min: v => (v !== undefined && v.length >= 8) || 'Min 8 characters',
Expand Down
1 change: 0 additions & 1 deletion www/webapp/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "@fontsource/roboto/400.css" /* regular */
import "@fontsource/roboto/400-italic.css" /* regular-italic */
import "@fontsource/roboto/500.css" /* medium */
import "@fontsource/roboto/700.css" /* bold */
import '@mdi/font/css/materialdesignicons.css'
import {createPinia, PiniaVuePlugin} from "pinia";


Expand Down
11 changes: 8 additions & 3 deletions www/webapp/src/views/ChangeEmail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/>
<v-text-field
v-model="password"
:append-icon="show ? 'mdi-eye' : 'mdi-eye-off'"
:append-icon="show ? mdiEyeOff : mdiEye"
prepend-icon="mdi-blank"
outlined
label="Password"
Expand All @@ -62,7 +62,7 @@
<v-text-field
v-model="new_email"
label="New Email"
prepend-icon="mdi-email"
:prepend-icon="mdiEmail"
outlined
required
:rules="[rules.required, rules.email]"
Expand Down Expand Up @@ -92,8 +92,9 @@
<script>
import { HTTP, withWorking ,digestError} from '@/utils';
import {email_pattern} from '@/validation';
import ErrorAlert from "@/components/ErrorAlert.vue";
import {mdiEmail, mdiEye, mdiEyeOff} from "@mdi/js";
export default {
name: 'ChangeEmail',
Expand All @@ -112,6 +113,10 @@
},
show: false,
mdiEmail: mdiEmail,
mdiEyeOff: mdiEyeOff,
mdiEye: mdiEye,
/* password field */
password: '',
password_errors: [],
Expand Down
5 changes: 4 additions & 1 deletion www/webapp/src/views/DeleteAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
/>
<v-text-field
v-model="password"
:append-icon="show ? 'mdi-eye' : 'mdi-eye-off'"
:append-icon="show ? mdiEyeOff : mdiEye"
prepend-icon="mdi-blank"
outlined
label="Password"
Expand Down Expand Up @@ -78,11 +78,14 @@
<script>
import { HTTP, withWorking, digestError } from '@/utils';
import ErrorAlert from "@/components/ErrorAlert.vue";
import {mdiEye, mdiEyeOff} from "@mdi/js";
export default {
name: 'DeleteAccount',
components: {ErrorAlert},
data: () => ({
mdiEyeOff: mdiEyeOff,
mdiEye: mdiEye,
valid: false,
working: false,
done: false,
Expand Down
2 changes: 1 addition & 1 deletion www/webapp/src/views/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ export default {
id: 'news-20231226001',
start: new Date(Date.UTC(2023, 12 - 1, 26)), // first day of showing
end: new Date(Date.UTC(2024, 1 - 1, 8)), // first day of not showing
icon: 'mdi-heart-broken',
icon: mdiHeartBroken,
teaser: "Due to a recent spike in abusive domain registrations, new accounts need manual verification before " +
"domains can be created. Please contact support explaining your use case to enable domain creation.",
},
Expand Down
5 changes: 4 additions & 1 deletion www/webapp/src/views/LoginPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<v-text-field
v-model="password"
label="Password"
:append-icon="hide_password ? 'mdi-eye' : 'mdi-eye-off'"
:append-icon="hide_password ? mdiEyeOff : mdiEye"
:type="hide_password ? 'password' : 'text'"
outlined
required
Expand Down Expand Up @@ -89,6 +89,7 @@
import { HTTP, digestError } from '@/utils';
import ErrorAlert from "@/components/ErrorAlert.vue";
import {useUserStore} from "@/store/user";
import {mdiEye, mdiEyeOff} from "@mdi/js";
export default {
name: 'LoginPage',
Expand All @@ -97,6 +98,8 @@ export default {
},
data: () => ({
user: useUserStore(),
mdiEyeOff: mdiEyeOff,
mdiEye: mdiEye,
valid: false,
working: false,
email: '',
Expand Down
17 changes: 12 additions & 5 deletions www/webapp/src/views/ResetPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<v-text-field
v-model="email"
label="Email"
prepend-icon="mdi-email"
:prepend-icon="mdiEmail"
outlined
required
:rules="email_rules"
Expand All @@ -59,7 +59,7 @@
<v-text-field
v-model="captchaSolution"
label="Type CAPTCHA text here"
prepend-icon="mdi-account-check"
:prepend-icon="mdiAccountCheck"
outlined
required
:rules="captcha_rules"
Expand Down Expand Up @@ -89,12 +89,12 @@
</audio>
<br/>
<v-btn-toggle>
<v-btn text outlined @click="getCaptcha(true)" :disabled="captchaWorking"><v-icon>mdi-refresh</v-icon></v-btn>
<v-btn text outlined @click="getCaptcha(true)" :disabled="captchaWorking"><v-icon>{{ mdiRefresh }}</v-icon></v-btn>
</v-btn-toggle>
&nbsp;
<v-btn-toggle v-model="captcha_kind">
<v-btn text outlined value="image" aria-label="Switch to Image CAPTCHA" :disabled="captchaWorking"><v-icon>mdi-eye</v-icon></v-btn>
<v-btn text outlined value="audio" aria-label="Switch to Audio CAPTCHA" :disabled="captchaWorking"><v-icon>mdi-ear-hearing</v-icon></v-btn>
<v-btn text outlined value="image" aria-label="Switch to Image CAPTCHA" :disabled="captchaWorking"><v-icon>{{ mdiEye }}</v-icon></v-btn>
<v-btn text outlined value="audio" aria-label="Switch to Audio CAPTCHA" :disabled="captchaWorking"><v-icon>{{ mdiEarHearing }}</v-icon></v-btn>
</v-btn-toggle>
</v-col>
</v-row>
Expand Down Expand Up @@ -122,6 +122,7 @@
import {email_pattern} from '@/validation';
import {digestError} from '@/utils';
import ErrorAlert from '@/components/ErrorAlert.vue';
import {mdiAccountCheck, mdiEarHearing, mdiEmail, mdiEye, mdiRefresh} from "@mdi/js";
const HTTP = axios.create({
baseURL: '/api/v1/',
Expand All @@ -141,6 +142,12 @@
errors: [],
captcha: null,
mdiAccountCheck: mdiAccountCheck,
mdiEarHearing: mdiEarHearing,
mdiEmail: mdiEmail,
mdiEye: mdiEye,
mdiRefresh: mdiRefresh,
/* email field */
email: '',
email_rules: [v => !!email_pattern.test(v || '') || 'We need an email address for account recovery and technical support.'],
Expand Down
20 changes: 14 additions & 6 deletions www/webapp/src/views/SignUp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<v-text-field
v-model="email"
label="Email"
prepend-icon="mdi-email"
:prepend-icon="mdiEmail"
outlined
required
:rules="email_rules"
Expand All @@ -48,7 +48,7 @@
hint="You can also use our REST API or web interface to create domains."
label="Do you want to set up a domain right away?"
persistent-hint
prepend-icon="mdi-dns"
:prepend-icon="mdiDns"
>
<v-radio label="Configure your own domain (Managed DNS or dynDNS)." value="custom" tabindex="2"></v-radio>
<v-radio :label="`Register a new domain under ${LOCAL_PUBLIC_SUFFIXES[0]} (dynDNS).`" value="dynDNS" tabindex="2"></v-radio>
Expand Down Expand Up @@ -82,7 +82,7 @@
<v-text-field
v-model="captchaSolution"
label="Type CAPTCHA text here"
prepend-icon="mdi-account-check"
:prepend-icon="mdiAccountCheck"
outlined
required
:rules="captcha_rules"
Expand Down Expand Up @@ -112,12 +112,12 @@
</audio>
<br/>
<v-btn-toggle>
<v-btn text outlined @click="getCaptcha(true)" :disabled="captchaWorking"><v-icon>mdi-refresh</v-icon></v-btn>
<v-btn text outlined @click="getCaptcha(true)" :disabled="captchaWorking"><v-icon>{{ mdiRefresh }}</v-icon></v-btn>
</v-btn-toggle>
&nbsp;
<v-btn-toggle v-model="captcha_kind">
<v-btn text outlined value="image" aria-label="Switch to Image CAPTCHA" :disabled="captchaWorking"><v-icon>mdi-eye</v-icon></v-btn>
<v-btn text outlined value="audio" aria-label="Switch to Audio CAPTCHA" :disabled="captchaWorking"><v-icon>mdi-ear-hearing</v-icon></v-btn>
<v-btn text outlined value="image" aria-label="Switch to Image CAPTCHA" :disabled="captchaWorking"><v-icon>{{ mdiEye }}</v-icon></v-btn>
<v-btn text outlined value="audio" aria-label="Switch to Audio CAPTCHA" :disabled="captchaWorking"><v-icon>{{ mdiEarHearing }}</v-icon></v-btn>
</v-btn-toggle>
</v-col>
</v-row>
Expand Down Expand Up @@ -177,6 +177,7 @@
import {domain_pattern, email_pattern} from '@/validation';
import {digestError} from '@/utils';
import ErrorAlert from "@/components/ErrorAlert.vue";
import {mdiAccountCheck, mdiDns, mdiEarHearing, mdiEmail, mdiEye, mdiRefresh} from "@mdi/js";
const LOCAL_PUBLIC_SUFFIXES = import.meta.env.VITE_APP_LOCAL_PUBLIC_SUFFIXES.split(' ');
Expand All @@ -199,6 +200,13 @@
captcha: null,
LOCAL_PUBLIC_SUFFIXES: LOCAL_PUBLIC_SUFFIXES,
mdiAccountCheck: mdiAccountCheck,
mdiDns: mdiDns,
mdiEarHearing: mdiEarHearing,
mdiEmail: mdiEmail,
mdiEye: mdiEye,
mdiRefresh: mdiRefresh,
/* email field */
email: '',
email_rules: [v => !!email_pattern.test(v || '') || 'We need an email address for account recovery and technical support.'],
Expand Down

0 comments on commit 82814f8

Please sign in to comment.