Add notice text field to events
Add a general text field for communicating extra information that readers of the schedule should pay special attention to, for example to highight a change made to the event.
This commit is contained in:
parent
9a46ea5af0
commit
f29b1f7afd
4 changed files with 15 additions and 3 deletions
|
@ -158,6 +158,7 @@ function newEvent() {
|
||||||
!newEventPublic.value,
|
!newEventPublic.value,
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
newEventDescription.value,
|
newEventDescription.value,
|
||||||
0,
|
0,
|
||||||
new Set(),
|
new Set(),
|
||||||
|
|
|
@ -92,6 +92,7 @@ export const apiScheduleEventSchema = defineApiEntity({
|
||||||
crew: z.optional(z.boolean()),
|
crew: z.optional(z.boolean()),
|
||||||
host: z.optional(z.string()),
|
host: z.optional(z.string()),
|
||||||
cancelled: z.optional(z.boolean()),
|
cancelled: z.optional(z.boolean()),
|
||||||
|
notice: z.optional(z.string()),
|
||||||
description: z.optional(z.string()),
|
description: z.optional(z.string()),
|
||||||
interested: z.optional(z.number()),
|
interested: z.optional(z.number()),
|
||||||
slots: z.array(apiScheduleEventSlotSchema),
|
slots: z.array(apiScheduleEventSlotSchema),
|
||||||
|
|
|
@ -21,10 +21,10 @@ function fixtureClientSchedule(multiSlot = false) {
|
||||||
|
|
||||||
const events = [
|
const events = [
|
||||||
new ClientScheduleEvent(
|
new ClientScheduleEvent(
|
||||||
1, now, false, "Up", false, "", false, "What's Up?", 0, new Set(multiSlot ? [1, 2] : [1]),
|
1, now, false, "Up", false, "", false, "", "What's Up?", 0, new Set(multiSlot ? [1, 2] : [1]),
|
||||||
),
|
),
|
||||||
new ClientScheduleEvent(
|
new ClientScheduleEvent(
|
||||||
2, now, false, "Down", false, "", false, "", 0, new Set(multiSlot ? [] : [2]),
|
2, now, false, "Down", false, "", false, "", "", 0, new Set(multiSlot ? [] : [2]),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
const eventSlots = idMap([
|
const eventSlots = idMap([
|
||||||
|
@ -174,7 +174,7 @@ describe("class ClientSchedule", () => {
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"event",
|
"event",
|
||||||
(schedule) => ClientScheduleEvent.create(schedule, 3, "New location", false, "", false, "", 0, new Set(), { zone, locale })
|
(schedule) => ClientScheduleEvent.create(schedule, 3, "New location", false, "", false, "", "", 0, new Set(), { zone, locale })
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"role",
|
"role",
|
||||||
|
|
|
@ -136,6 +136,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
serverCrew: boolean;
|
serverCrew: boolean;
|
||||||
serverHost: string;
|
serverHost: string;
|
||||||
serverCancelled: boolean;
|
serverCancelled: boolean;
|
||||||
|
serverNotice: string;
|
||||||
serverDescription: string;
|
serverDescription: string;
|
||||||
serverInterested: number;
|
serverInterested: number;
|
||||||
serverSlotIds: Set<Id>;
|
serverSlotIds: Set<Id>;
|
||||||
|
@ -148,6 +149,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
public crew: boolean,
|
public crew: boolean,
|
||||||
public host: string,
|
public host: string,
|
||||||
public cancelled: boolean,
|
public cancelled: boolean,
|
||||||
|
public notice: string,
|
||||||
public description: string,
|
public description: string,
|
||||||
public interested: number,
|
public interested: number,
|
||||||
public slotIds: Set<Id>,
|
public slotIds: Set<Id>,
|
||||||
|
@ -157,6 +159,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
this.serverCrew = crew;
|
this.serverCrew = crew;
|
||||||
this.serverHost = host;
|
this.serverHost = host;
|
||||||
this.serverCancelled = cancelled;
|
this.serverCancelled = cancelled;
|
||||||
|
this.serverNotice = notice;
|
||||||
this.serverDescription = description;
|
this.serverDescription = description;
|
||||||
this.serverInterested = interested;
|
this.serverInterested = interested;
|
||||||
this.serverSlotIds = new Set(slotIds);
|
this.serverSlotIds = new Set(slotIds);
|
||||||
|
@ -173,6 +176,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
|| this.crew !== this.serverCrew
|
|| this.crew !== this.serverCrew
|
||||||
|| this.host !== this.serverHost
|
|| this.host !== this.serverHost
|
||||||
|| this.cancelled !== this.serverCancelled
|
|| this.cancelled !== this.serverCancelled
|
||||||
|
|| this.notice !== this.serverNotice
|
||||||
|| this.description !== this.serverDescription
|
|| this.description !== this.serverDescription
|
||||||
|| this.interested !== this.serverInterested
|
|| this.interested !== this.serverInterested
|
||||||
|| !setEquals(this.slotIds, this.serverSlotIds)
|
|| !setEquals(this.slotIds, this.serverSlotIds)
|
||||||
|
@ -190,6 +194,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
this.crew = this.serverCrew;
|
this.crew = this.serverCrew;
|
||||||
this.host = this.serverHost;
|
this.host = this.serverHost;
|
||||||
this.cancelled = this.serverCancelled;
|
this.cancelled = this.serverCancelled;
|
||||||
|
this.notice = this.serverNotice;
|
||||||
this.description = this.serverDescription;
|
this.description = this.serverDescription;
|
||||||
this.interested = this.serverInterested;
|
this.interested = this.serverInterested;
|
||||||
for (const id of this.serverSlotIds) {
|
for (const id of this.serverSlotIds) {
|
||||||
|
@ -208,6 +213,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
crew: boolean,
|
crew: boolean,
|
||||||
host: string,
|
host: string,
|
||||||
cancelled: boolean,
|
cancelled: boolean,
|
||||||
|
notice: string,
|
||||||
description: string,
|
description: string,
|
||||||
interested: number,
|
interested: number,
|
||||||
slotIds: Set<Id>,
|
slotIds: Set<Id>,
|
||||||
|
@ -221,6 +227,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
crew,
|
crew,
|
||||||
host,
|
host,
|
||||||
cancelled,
|
cancelled,
|
||||||
|
notice,
|
||||||
description,
|
description,
|
||||||
interested,
|
interested,
|
||||||
slotIds,
|
slotIds,
|
||||||
|
@ -241,6 +248,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
api.crew ?? false,
|
api.crew ?? false,
|
||||||
api.host ?? "",
|
api.host ?? "",
|
||||||
api.cancelled ?? false,
|
api.cancelled ?? false,
|
||||||
|
api.notice ?? "",
|
||||||
api.description ?? "",
|
api.description ?? "",
|
||||||
api.interested ?? 0,
|
api.interested ?? 0,
|
||||||
new Set(api.slots.map(slot => slot.id)),
|
new Set(api.slots.map(slot => slot.id)),
|
||||||
|
@ -258,6 +266,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
this.serverCrew = api.crew ?? false;
|
this.serverCrew = api.crew ?? false;
|
||||||
this.serverHost = api.host ?? "";
|
this.serverHost = api.host ?? "";
|
||||||
this.serverCancelled = api.cancelled ?? false;
|
this.serverCancelled = api.cancelled ?? false;
|
||||||
|
this.serverNotice = api.notice ?? "";
|
||||||
this.serverDescription = api.description ?? "";
|
this.serverDescription = api.description ?? "";
|
||||||
this.serverInterested = api.interested ?? 0;
|
this.serverInterested = api.interested ?? 0;
|
||||||
this.serverSlotIds = new Set(api.slots.map(slot => slot.id));
|
this.serverSlotIds = new Set(api.slots.map(slot => slot.id));
|
||||||
|
@ -281,6 +290,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
||||||
crew: this.crew || undefined,
|
crew: this.crew || undefined,
|
||||||
host: this.host || undefined,
|
host: this.host || undefined,
|
||||||
cancelled: this.cancelled || undefined,
|
cancelled: this.cancelled || undefined,
|
||||||
|
notice: this.notice || undefined,
|
||||||
description: this.description || undefined,
|
description: this.description || undefined,
|
||||||
interested: this.interested || undefined,
|
interested: this.interested || undefined,
|
||||||
slots: [...this.slots.values()].filter(slot => !slot.deleted).map(slot => slot.toApi()),
|
slots: [...this.slots.values()].filter(slot => !slot.deleted).map(slot => slot.toApi()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue