Allow to register custom categories

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-03-28 20:02:43 +02:00
parent f5bdedf789
commit 368911b58e
40 changed files with 4587 additions and 725 deletions

View File

@@ -11,6 +11,10 @@ export const CONFIG = gql`
demoMode
countryCode
languages
eventCategories {
id
label
}
anonymous {
participation {
allowed
@@ -103,6 +107,10 @@ export const CONFIG_EDIT_EVENT = gql`
features {
groups
}
eventCategories {
id
label
}
anonymous {
participation {
allowed

View File

@@ -1307,21 +1307,6 @@
"Last seen on": "Last seen on",
"No user matches the filters": "No user matches the filters",
"Reset filters": "Reset filters",
"Arts": "Arts",
"Book Clubs": "Book Clubs",
"Business": "Business",
"Causes": "Causes",
"Comedy": "Comedy",
"Crafts": "Crafts",
"Food & Drink": "Food & Drink",
"Health": "Health",
"Music": "Music",
"Auto, Boat & Air": "Auto, Boat & Air",
"Community": "Community",
"Family & Education": "Family & Education",
"Fashion & Beauty": "Fashion & Beauty",
"Film & Media": "Film & Media",
"Games": "Games",
"Category": "Category",
"Select a category": "Select a category",
"Any category": "Any category"

View File

@@ -1306,21 +1306,6 @@
"{title} ({count} todos)": "{title} ({count} todos)",
"{username} was invited to {group}": "{username} a été invité à {group}",
"© The OpenStreetMap Contributors": "© Les Contributeur⋅ices OpenStreetMap",
"Arts": "Arts",
"Book Clubs": "Clubs de lecture",
"Business": "Entreprises",
"Causes": "Causes",
"Comedy": "Comédie",
"Crafts": "Artisanat",
"Food & Drink": "Alimentation et boissons",
"Health": "Santé",
"Music": "Musique",
"Auto, Boat & Air": "Automobile, bateaux et aéronautique",
"Community": "Communauté",
"Family & Education": "Famille et éducation",
"Fashion & Beauty": "Mode et beauté",
"Film & Media": "Films et médias",
"Games": "Jeux",
"Category": "Catégorie",
"Select a category": "Choisissez une categorie",
"Any category": "N'importe quelle catégorie"

View File

@@ -17,6 +17,7 @@ export interface IConfig {
registrationsAllowlist: boolean;
demoMode: boolean;
countryCode: string;
eventCategories: { id: string; label: string }[];
languages: string[];
location: {
latitude: number;

View File

@@ -1,68 +0,0 @@
import { i18n } from "@/utils/i18n";
export const eventCategories = [
{
id: "ARTS",
label: i18n.t("Arts"),
icon: "palette",
},
{
id: "BOOK_CLUBS",
label: i18n.t("Book Clubs"),
icon: "favourite-book",
},
{
id: "BUSINESS",
label: i18n.t("Business"),
},
{
id: "CAUSES",
label: i18n.t("Causes"),
},
{
id: "COMEDY",
label: i18n.t("Comedy"),
},
{
id: "CRAFTS",
label: i18n.t("Crafts"),
},
{
id: "FOOD_DRINK",
label: i18n.t("Food & Drink"),
},
{
id: "HEALTH",
label: i18n.t("Health"),
},
{
id: "MUSIC",
label: i18n.t("Music"),
},
{
id: "AUTO_BOAT_AIR",
label: i18n.t("Auto, Boat & Air"),
},
{
id: "COMMUNITY",
label: i18n.t("Community"),
},
{
id: "FAMILY_EDUCATION",
label: i18n.t("Family & Education"),
},
{
id: "FASHION_BEAUTY",
label: i18n.t("Fashion & Beauty"),
},
{
id: "FILM_MEDIA",
label: i18n.t("Film & Media"),
},
{
id: "GAMES",
label: i18n.t("Games"),
},
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
].sort(({ label: label1 }, { label: label2 }) => label1.localeCompare(label2));

View File

@@ -34,6 +34,7 @@
<div class="flex flex-wrap gap-4">
<b-field
v-if="config"
:label="$t('Category')"
label-for="category"
class="w-full md:max-w-fit"
@@ -44,7 +45,7 @@
expanded
>
<option
v-for="category in eventCategories"
v-for="category in config.eventCategories"
:value="category.id"
:key="category.id"
>
@@ -665,7 +666,6 @@ import { USER_SETTINGS } from "@/graphql/user";
import { IUser } from "@/types/current-user.model";
import { IAddress } from "@/types/address.model";
import { LOGGED_USER_PARTICIPATIONS } from "@/graphql/participant";
import { eventCategories } from "@/utils/categories";
const DEFAULT_LIMIT_NUMBER_OF_PLACES = 10;
@@ -775,8 +775,6 @@ export default class EditEvent extends Vue {
formatList = formatList;
eventCategories = eventCategories;
@Watch("eventId", { immediate: true })
resetFormForCreation(eventId: string): void {
if (eventId === undefined) {

View File

@@ -507,7 +507,6 @@ import { IEventMetadataDescription } from "@/types/event-metadata";
import { eventMetaDataList } from "../../services/EventMetadata";
import { USER_SETTINGS } from "@/graphql/user";
import { IUser } from "@/types/current-user.model";
import { eventCategories } from "@/utils/categories";
// noinspection TypeScriptValidateTypes
@Component({
@@ -1138,7 +1137,7 @@ export default class Event extends EventMixin {
if (this.event?.category === "MEETING") {
return undefined;
}
return eventCategories.find((eventCategory) => {
return this.config.eventCategories.find((eventCategory) => {
return eventCategory.id === this.event?.category;
})?.label as string;
}

View File

@@ -109,7 +109,7 @@
</option>
<option
:value="category.id"
v-for="category in eventCategories"
v-for="category in config.eventCategories"
:key="category.id"
>
{{ category.label }}
@@ -247,7 +247,6 @@ import { REVERSE_GEOCODE } from "../graphql/address";
import debounce from "lodash/debounce";
import { CURRENT_USER_CLIENT } from "@/graphql/user";
import { ICurrentUser } from "@/types/current-user.model";
import { eventCategories } from "@/utils/categories";
interface ISearchTimeOption {
label: string;
@@ -389,8 +388,6 @@ export default class Search extends Vue {
GROUP_PAGE_LIMIT = GROUP_PAGE_LIMIT;
eventCategories = eventCategories;
$refs!: {
aac: FullAddressAutoComplete;
autocompleteSearchInput: any;