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,
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
newEventDescription.value,
|
||||
0,
|
||||
new Set(),
|
||||
|
|
|
@ -92,6 +92,7 @@ export const apiScheduleEventSchema = defineApiEntity({
|
|||
crew: z.optional(z.boolean()),
|
||||
host: z.optional(z.string()),
|
||||
cancelled: z.optional(z.boolean()),
|
||||
notice: z.optional(z.string()),
|
||||
description: z.optional(z.string()),
|
||||
interested: z.optional(z.number()),
|
||||
slots: z.array(apiScheduleEventSlotSchema),
|
||||
|
|
|
@ -21,10 +21,10 @@ function fixtureClientSchedule(multiSlot = false) {
|
|||
|
||||
const events = [
|
||||
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(
|
||||
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([
|
||||
|
@ -174,7 +174,7 @@ describe("class ClientSchedule", () => {
|
|||
],
|
||||
[
|
||||
"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",
|
||||
|
|
|
@ -136,6 +136,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
serverCrew: boolean;
|
||||
serverHost: string;
|
||||
serverCancelled: boolean;
|
||||
serverNotice: string;
|
||||
serverDescription: string;
|
||||
serverInterested: number;
|
||||
serverSlotIds: Set<Id>;
|
||||
|
@ -148,6 +149,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
public crew: boolean,
|
||||
public host: string,
|
||||
public cancelled: boolean,
|
||||
public notice: string,
|
||||
public description: string,
|
||||
public interested: number,
|
||||
public slotIds: Set<Id>,
|
||||
|
@ -157,6 +159,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
this.serverCrew = crew;
|
||||
this.serverHost = host;
|
||||
this.serverCancelled = cancelled;
|
||||
this.serverNotice = notice;
|
||||
this.serverDescription = description;
|
||||
this.serverInterested = interested;
|
||||
this.serverSlotIds = new Set(slotIds);
|
||||
|
@ -173,6 +176,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
|| this.crew !== this.serverCrew
|
||||
|| this.host !== this.serverHost
|
||||
|| this.cancelled !== this.serverCancelled
|
||||
|| this.notice !== this.serverNotice
|
||||
|| this.description !== this.serverDescription
|
||||
|| this.interested !== this.serverInterested
|
||||
|| !setEquals(this.slotIds, this.serverSlotIds)
|
||||
|
@ -190,6 +194,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
this.crew = this.serverCrew;
|
||||
this.host = this.serverHost;
|
||||
this.cancelled = this.serverCancelled;
|
||||
this.notice = this.serverNotice;
|
||||
this.description = this.serverDescription;
|
||||
this.interested = this.serverInterested;
|
||||
for (const id of this.serverSlotIds) {
|
||||
|
@ -208,6 +213,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
crew: boolean,
|
||||
host: string,
|
||||
cancelled: boolean,
|
||||
notice: string,
|
||||
description: string,
|
||||
interested: number,
|
||||
slotIds: Set<Id>,
|
||||
|
@ -221,6 +227,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
crew,
|
||||
host,
|
||||
cancelled,
|
||||
notice,
|
||||
description,
|
||||
interested,
|
||||
slotIds,
|
||||
|
@ -241,6 +248,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
api.crew ?? false,
|
||||
api.host ?? "",
|
||||
api.cancelled ?? false,
|
||||
api.notice ?? "",
|
||||
api.description ?? "",
|
||||
api.interested ?? 0,
|
||||
new Set(api.slots.map(slot => slot.id)),
|
||||
|
@ -258,6 +266,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
this.serverCrew = api.crew ?? false;
|
||||
this.serverHost = api.host ?? "";
|
||||
this.serverCancelled = api.cancelled ?? false;
|
||||
this.serverNotice = api.notice ?? "";
|
||||
this.serverDescription = api.description ?? "";
|
||||
this.serverInterested = api.interested ?? 0;
|
||||
this.serverSlotIds = new Set(api.slots.map(slot => slot.id));
|
||||
|
@ -281,6 +290,7 @@ export class ClientScheduleEvent extends ClientEntity<ApiScheduleEvent> {
|
|||
crew: this.crew || undefined,
|
||||
host: this.host || undefined,
|
||||
cancelled: this.cancelled || undefined,
|
||||
notice: this.notice || undefined,
|
||||
description: this.description || undefined,
|
||||
interested: this.interested || undefined,
|
||||
slots: [...this.slots.values()].filter(slot => !slot.deleted).map(slot => slot.toApi()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue