Skip to content

Commit d21a06e

Browse files
authored
Merge branch 'feature/update-vue' into update-tests
2 parents 37d9970 + 04e61cb commit d21a06e

File tree

7 files changed

+1616
-1391
lines changed

7 files changed

+1616
-1391
lines changed

.eslintrc.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ module.exports = {
1212
rules: {
1313
'max-len': [ 'error', 120 ],
1414
'no-multiple-empty-lines' : ['error', { 'max': 1 }],
15-
'vue/multi-word-component-names' : [ 'off' ]
16-
},
15+
'vue/multi-word-component-names' : [ 'off' ],
16+
// Migration changes
17+
'vue/no-deprecated-v-bind-sync': 'off',
18+
'vue/no-deprecated-slot-attribute': 'off',
19+
'vue/require-explicit-emits': 'off',
20+
'vue/no-deprecated-v-on-native-modifier': 'off',
21+
'vue/no-deprecated-slot-scope-attribute': 'off',
22+
'vue/no-v-for-template-key-on-child': 'off',
23+
'vue/no-deprecated-destroyed-lifecycle': 'off',
24+
'vue/no-v-model-argument': 'off'
25+
},
1726
};

package-lock.json

Lines changed: 1508 additions & 1327 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
"@types/lodash": "^4.14.199",
2121
"@typescript-eslint/eslint-plugin": "^6.7.5",
2222
"@typescript-eslint/parser": "^6.7.5",
23-
"@vue/compiler-sfc": "3.2.0",
23+
"@vue/compiler-sfc": "^3.3.8",
2424
"@vue/eslint-config-typescript": "^12.0.0",
2525
"@vue/test-utils": "^2.0.0",
2626
"@vue/vue3-jest": "^29.2.4",
27-
"@vue/runtime-dom": "3.2.0",
27+
"@vue/runtime-dom": "^3.3.8",
2828
"@wikimedia/codex": "^0.20.0",
2929
"@wikimedia/codex-design-tokens": "^0.20.0",
3030
"@wikimedia/codex-icons": "^0.20.0",
@@ -50,25 +50,14 @@
5050
"dependencies": {
5151
"@inertiajs/inertia": "^0.11.0",
5252
"@inertiajs/inertia-vue3": "^0.6.0",
53-
"@vue/compat": "3.2.0",
53+
"@vue/compat": "^3.3.8",
5454
"@wmde/wikit-tokens": "^2.1.0-alpha.15",
5555
"@wmde/wikit-vue-components": "^2.1.0-alpha.16",
5656
"date-fns": "^2.30.0",
5757
"lodash": "^4.17.21",
5858
"pinia": "^2.1.7",
5959
"ress": "^5.0.2",
60-
"vue": "3.2.0",
60+
"vue": "^3.3.8",
6161
"vue-banana-i18n": "2.3.0"
62-
},
63-
"overrides": {
64-
"pinia": {
65-
"vue": "3.2.0"
66-
},
67-
"@wikimedia/codex": {
68-
"vue": "3.2.0"
69-
},
70-
"vue-banana-i18n": {
71-
"banana-i18n": "2.2.0"
72-
}
7362
}
7463
}

resources/js/Components/MismatchRow.vue

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@
4646
</span>
4747
</td>
4848
<td :data-header="$i18n('column-review-status')">
49-
<dropdown
50-
:menuItems="Object.values(statusOptions)"
49+
<cdx-select
50+
:menu-items="Object.values(statusOptions)"
5151
:disabled="disabled"
52-
v-model="decision"
53-
@input="$bubble('decision', {
52+
v-model:selected="reviewStatus"
53+
@update:selected="$bubble('decision', {
5454
id: mismatch.id,
5555
item_id: mismatch.item_id,
56-
review_status: $event.value
56+
review_status: $event
5757
})"
5858
/>
5959
</td>
@@ -79,15 +79,16 @@
7979
</wikit-button>
8080
</div>
8181
</div>
82-
<wikit-dialog class="full-description-dialog"
82+
<cdx-dialog class="full-description-dialog"
8383
:title="$i18n('column-upload-info')"
84-
ref="fullDescriptionDialog"
85-
:actions="[{
84+
:open="fullDescriptionDialog"
85+
:primary-action="{
8686
label: $i18n('confirm-dialog-button'),
87-
namespace: 'next-steps-confirm'
88-
}]"
89-
@action="(_, dialog) => dialog.hide()"
90-
dismiss-button
87+
namespace: 'next-steps-confirm',
88+
actionType: 'progressive'
89+
}"
90+
@primary="() => fullDescriptionDialog = false"
91+
close-button-label="X"
9192
>
9293
<wikit-link class="uploader"
9394
:href="`https://www.wikidata.org/wiki/User:${mismatch.import_meta.user.username}`"
@@ -99,7 +100,7 @@
99100
<div class="description">
100101
{{this.mismatch.import_meta.description}}
101102
</div>
102-
</wikit-dialog>
103+
</cdx-dialog>
103104
</td>
104105
</tr>
105106
</template>
@@ -111,10 +112,9 @@ import type { PropType } from 'vue';
111112
import { defineComponent } from 'vue';
112113
import {
113114
Button as WikitButton,
114-
Dialog as WikitDialog,
115-
Dropdown,
116115
Link as WikitLink
117116
} from '@wmde/wikit-vue-components';
117+
import { CdxDialog, CdxSelect } from "@wikimedia/codex";
118118
import { MenuItem } from '@wmde/wikit-vue-components/dist/components/MenuItem';
119119
120120
import { LabelledMismatch, ReviewDecision } from "../types/Mismatch";
@@ -132,14 +132,16 @@ type ReviewOptionMap = {
132132
interface MismatchRowState {
133133
statusOptions: ReviewOptionMap;
134134
decision: ReviewMenuItem;
135+
reviewStatus: string;
136+
fullDescriptionDialog: boolean;
135137
}
136138
137139
export default defineComponent({
138140
components: {
139141
WikitButton,
140142
WikitLink,
141-
WikitDialog,
142-
Dropdown,
143+
CdxDialog,
144+
CdxSelect
143145
},
144146
props: {
145147
mismatch: Object as PropType<LabelledMismatch>,
@@ -183,14 +185,14 @@ export default defineComponent({
183185
return {
184186
statusOptions,
185187
decision: statusOptions[this.mismatch.review_status],
188+
reviewStatus: String(this.mismatch.review_status),
189+
fullDescriptionDialog: false
186190
};
187191
},
188192
methods: {
189193
showDialog(e: Event) {
190194
e.preventDefault();
191-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
192-
const descriptionDialog = this.$refs.fullDescriptionDialog! as any;
193-
descriptionDialog.show();
195+
this.fullDescriptionDialog = true;
194196
}
195197
}
196198
});

resources/js/Pages/Playground.vue

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
<template>
2-
<div>
3-
2+
<div lang="en">
3+
<inertia-head title="Mismatch Finder - Component Playground" />
4+
<h2>Mismatch Finder - Playground!</h2>
5+
<p>Feel free to throw any component you want to try, in here</p>
46
</div>
57
</template>
8+
9+
<script lang="ts">
10+
import { defineComponent } from 'vue';
11+
import { Head as InertiaHead } from '@inertiajs/inertia-vue3'
12+
13+
export default defineComponent({
14+
components: { InertiaHead },
15+
props: {
16+
user: Object,
17+
},
18+
methods: {
19+
console() {
20+
console.log('testing wikit component');
21+
},
22+
printVal(v: string) {
23+
console.log(v);
24+
}
25+
},
26+
data(){
27+
return {
28+
controlled: true,
29+
standalone: false
30+
}
31+
}
32+
});
33+
</script>
34+
35+
<style lang="scss">
36+
button.wikit {
37+
margin-bottom: 1rem;
38+
}
39+
40+
.fancy-dialog {
41+
h2 {
42+
margin-bottom: 0.5em;
43+
}
44+
45+
p {
46+
margin-bottom: 1.25em;
47+
}
48+
49+
.wikit-Dialog__close {
50+
margin-bottom: 0;
51+
}
52+
}
53+
</style>

resources/js/Pages/Results.vue

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
v-model:open="instructionsDialog"
3030
:primary-action="{
3131
label: $i18n('confirm-dialog-button'),
32-
namespace: 'instructions-confirm'
32+
namespace: 'instructions-confirm',
33+
actionType: 'progressive'
3334
}"
3435
@primary="() => instructionsDialog = false"
3536
close-button-label="X"
@@ -108,16 +109,17 @@
108109
</form>
109110
</section>
110111
</section>
111-
<wikit-dialog class="confirmation-dialog"
112+
<cdx-dialog class="confirmation-dialog"
112113
:title="$i18n('confirmation-dialog-title')"
113-
ref="confirmation"
114-
:actions="[{
114+
v-model:open="confirmationDialog"
115+
:primary-action="{
115116
label: $i18n('confirmation-dialog-button'),
116-
namespace: 'next-steps-confirm'
117-
}]"
118-
@action="_handleConfirmation"
119-
@dismissed="disableConfirmation = false"
120-
dismiss-button
117+
namespace: 'next-steps-confirm',
118+
actionType: 'progressive'
119+
120+
}"
121+
@primary="_handleConfirmation"
122+
close-button-label="X"
121123
>
122124
<p>{{ $i18n('confirmation-dialog-message-intro') }}</p>
123125
<ul>
@@ -129,7 +131,7 @@
129131
:label="$i18n('confirmation-dialog-option-label')"
130132
:checked.sync="disableConfirmation"
131133
/>
132-
</wikit-dialog>
134+
</cdx-dialog>
133135
</div>
134136
</template>
135137

@@ -142,7 +144,6 @@
142144
Link as WikitLink,
143145
Button as WikitButton,
144146
Checkbox,
145-
Dialog as WikitDialog,
146147
Icon,
147148
Message } from '@wmde/wikit-vue-components';
148149
@@ -186,7 +187,8 @@
186187
pageDirection: string,
187188
requestError: boolean,
188189
lastSubmitted: string,
189-
instructionsDialog: boolean
190+
instructionsDialog: boolean,
191+
confirmationDialog: boolean
190192
}
191193
192194
export default defineComponent({
@@ -197,7 +199,6 @@
197199
MismatchesTable,
198200
WikitLink,
199201
WikitButton,
200-
WikitDialog,
201202
Checkbox,
202203
Message,
203204
CdxDialog
@@ -259,7 +260,8 @@
259260
pageDirection: 'ltr',
260261
requestError: false,
261262
lastSubmitted: '',
262-
instructionsDialog: false
263+
instructionsDialog: false,
264+
confirmationDialog: false
263265
}
264266
},
265267
methods: {
@@ -308,7 +310,6 @@
308310
// Defaulting to any, as the alternative presents us with
309311
// convoluted and unnecessary syntax.
310312
// eslint-disable-next-line @typescript-eslint/no-explicit-any
311-
const confirmationDialog = this.$refs.confirmation as any;
312313
// eslint-disable-next-line @typescript-eslint/no-explicit-any
313314
const overlay = this.$refs.overlay as any;
314315
@@ -324,7 +325,7 @@
324325
this.showSubmitConfirmation(item);
325326
326327
if(!this.disableConfirmation){
327-
confirmationDialog.show();
328+
this.confirmationDialog = true;
328329
}
329330
} catch(e) {
330331
this.requestError = true;
@@ -358,7 +359,7 @@
358359
// understand component instances and complains about usage of the
359360
// hide method otherwise.
360361
// eslint-disable-next-line @typescript-eslint/no-explicit-any
361-
_handleConfirmation(_ : string, dialog: any){
362+
_handleConfirmation(){
362363
const { disableConfirmation, user } = this;
363364
364365
// Do nothing if there is no user
@@ -371,7 +372,7 @@
371372
window.localStorage.setItem(`mismatch-finder_user-settings_${user.id}`, storageData);
372373
}
373374
374-
dialog.hide();
375+
this.confirmationDialog = false;
375376
}
376377
}
377378
});

resources/js/app.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,18 @@ import './bootstrap';
22
import {createApp, h} from 'vue';
33
import {createPinia} from 'pinia';
44
import {createInertiaApp} from '@inertiajs/inertia-vue3';
5-
import i18nMessages, { I18nMessages } from './lib/i18n';
5+
import getI18nMessages, { I18nMessages } from './lib/i18n';
66
import {createI18n} from 'vue-banana-i18n'
77
import bubble from './lib/bubble';
88
import Error from './Pages/Error.vue';
99
import Layout from './Pages/Layout.vue';
1010

11-
// Retrieve i18n messages and setup the Vue instance to handle them.
12-
async function setupI18n(locale: string): Promise<I18nMessages>{
13-
return await i18nMessages(locale);
14-
}
15-
1611
// Only bootstrap inertia if setup is successful. Display generic error
1712
// component otherwise
1813
(async () => {
1914
try {
2015
const locale = document.documentElement.lang;
21-
const i18nMessages = await setupI18n(locale);
16+
const i18nMessages = await getI18nMessages(locale);
2217
const pinia = createPinia();
2318
const i18nPlugin = createI18n({
2419
locale: locale,

0 commit comments

Comments
 (0)