Merge branch 'main' into '1481-trying-to-contact-the-organizer-contact-crashes-the-app'
# Conflicts: # package.json
This commit is contained in:
@@ -22,7 +22,12 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
import { computed, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const { locale } = useI18n({ useScope: "global" });
|
||||
|
||||
const localeConverted = locale.replace("_", "-");
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -35,15 +40,15 @@ const props = withDefaults(
|
||||
const dateObj = computed<Date>(() => new Date(props.date));
|
||||
|
||||
const month = computed<string>(() =>
|
||||
dateObj.value.toLocaleString(undefined, { month: "short" })
|
||||
dateObj.value.toLocaleString(localeConverted, { month: "short" })
|
||||
);
|
||||
|
||||
const day = computed<string>(() =>
|
||||
dateObj.value.toLocaleString(undefined, { day: "numeric" })
|
||||
dateObj.value.toLocaleString(localeConverted, { day: "numeric" })
|
||||
);
|
||||
|
||||
const weekday = computed<string>(() =>
|
||||
dateObj.value.toLocaleString(undefined, { weekday: "short" })
|
||||
dateObj.value.toLocaleString(localeConverted, { weekday: "short" })
|
||||
);
|
||||
|
||||
const smallStyle = computed<string>(() => (props.small ? "1.2" : "2"));
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="flex-1" v-else>
|
||||
{{ `@${selectedActor.preferredUsername}` }}
|
||||
</div>
|
||||
<o-button type="text" @click="isComponentModalActive = true">
|
||||
<o-button @click="isComponentModalActive = true">
|
||||
{{ $t("Change") }}
|
||||
</o-button>
|
||||
</div>
|
||||
|
||||
@@ -13,8 +13,14 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
import Clock from "vue-material-design-icons/ClockTimeTenOutline.vue";
|
||||
|
||||
const { locale } = useI18n({ useScope: "global" });
|
||||
|
||||
const localeConverted = locale.replace("_", "-");
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
date: string;
|
||||
@@ -26,7 +32,7 @@ const props = withDefaults(
|
||||
const dateObj = computed<Date>(() => new Date(props.date));
|
||||
|
||||
const time = computed<string>(() =>
|
||||
dateObj.value.toLocaleTimeString(undefined, {
|
||||
dateObj.value.toLocaleTimeString(localeConverted, {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
})
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
</template>
|
||||
<o-taginput
|
||||
:modelValue="tagsStrings"
|
||||
@update:modelValue="updateTags"
|
||||
@remove="remove"
|
||||
@add="add"
|
||||
:data="filteredTags"
|
||||
:allow-autocomplete="true"
|
||||
:allow-new="true"
|
||||
@@ -69,6 +70,8 @@ const id = computed((): string => {
|
||||
|
||||
const { load: fetchTags } = useFetchTags();
|
||||
|
||||
initTagsStringsValue();
|
||||
|
||||
const getFilteredTags = async (newText: string): Promise<void> => {
|
||||
text.value = newText;
|
||||
const res = await fetchTags(
|
||||
@@ -91,11 +94,16 @@ const filteredTags = computed((): ITag[] => {
|
||||
);
|
||||
});
|
||||
|
||||
watch(props.modelValue, (newValue, oldValue) => {
|
||||
if (newValue != oldValue) {
|
||||
tagsStrings.value = propsValue.value.map((tag: ITag) => tag.title);
|
||||
}
|
||||
});
|
||||
// TODO It seems that '@update:modelValue="updateTags"' does not works anymore...
|
||||
// so temporarily call the function updateTags() at remove and add tag event
|
||||
// https://github.com/oruga-ui/oruga/issues/967
|
||||
function remove() {
|
||||
updateTags(tagsStrings.value);
|
||||
}
|
||||
|
||||
function add() {
|
||||
updateTags(tagsStrings.value);
|
||||
}
|
||||
|
||||
const updateTags = (newTagsStrings: string[]) => {
|
||||
const tagEntities = newTagsStrings.map((tag: string | ITag) => {
|
||||
@@ -106,4 +114,34 @@ const updateTags = (newTagsStrings: string[]) => {
|
||||
});
|
||||
emit("update:modelValue", tagEntities);
|
||||
};
|
||||
|
||||
function isArraysEquals(array1: string[], array2: string[]) {
|
||||
if (array1.length !== array2.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < array1.length; i++) {
|
||||
if (array1[i] !== array2[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function initTagsStringsValue() {
|
||||
// This is useful when tag data is already cached from the API during navigation inside the app
|
||||
tagsStrings.value = propsValue.value.map((tag: ITag) => tag.title);
|
||||
|
||||
// This watch() function is useful when tag data loads directly from the API upon page load
|
||||
watch(propsValue, () => {
|
||||
const newTagsStrings = propsValue.value.map((tag: ITag) => tag.title);
|
||||
|
||||
// Changing tagsStrings.value triggers updateTags(), updateTags() triggers this watch() function again.
|
||||
// To stop the loop, edit tagsStrings.value only if it has changed !
|
||||
if (!isArraysEquals(tagsStrings.value, newTagsStrings)) {
|
||||
tagsStrings.value = newTagsStrings;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user