directus-labs / agency-os

The open source operating system for digital agencies. Built with Directus and Nuxt.
https://agencyos.dev
MIT License
586 stars 113 forks source link

Extend globals #94

Closed hoamer closed 3 months ago

hoamer commented 5 months ago

Hello together!

I want to extend globals in AgencyOS.

On Directus-site

For that, I added a field in Directus, which extends globals. This is the response for "/items/globals":

...
    "theme": {
      "primary": "violet",
      "gray": "slate",
      "borderRadius": "xl",
      "fonts": {
        "families": {
          "display": "Poppins",
          "body": "Inter",
          "code": "Fira Code"
        }
      }
    },
    **"opening_hours": [
      {
        "day": "Montag",
        "hours_from": "08:00",
        "hours_to": "17:00"
      },
    ]
...

On AgencyOS/Nuxt-Side extended the following files

globals.ts

opening_hours: { [key: string]: any } | null;

organization.ts

export interface Organization {
...
    opening_hours?: (string | OpeningHours)[];
...
}
export interface OpeningHours {
    id?: string;
    day?: string | null;
    hours_from?: string | null;
    hours_to?: string | null;
}

What am I do I forget?

ComfortablyCoding commented 3 months ago

That looks correct to me, all that should be left is to update whatever component you want that data pulled into and displayed. As this is not an issue I will be closing for now, happy to re-open If it becomes one.

If you need any further help regarding customization the discord is the best place for these types of questions.