Skip to content

Commit

Permalink
re-use a json schema type for icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Oct 22, 2024
1 parent fcddf24 commit 001879b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
41 changes: 18 additions & 23 deletions special-pages/messages/new-tab/types/rmf-message.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,8 @@
"type": "string"
},
"icon": {
"enum": [
"Announce",
"DDGAnnounce",
"CriticalUpdate",
"AppUpdate",
"PrivacyPro"
]
},
"$ref": "#/definitions/rmf-icon"
}
},
"required": [
"messageType",
Expand All @@ -84,13 +78,7 @@
"type": "string"
},
"icon": {
"enum": [
"Announce",
"DDGAnnounce",
"CriticalUpdate",
"AppUpdate",
"PrivacyPro"
]
"$ref": "#/definitions/rmf-icon"
},
"primaryActionText": {
"type": "string"
Expand Down Expand Up @@ -122,13 +110,7 @@
"type": "string"
},
"icon": {
"enum": [
"Announce",
"DDGAnnounce",
"CriticalUpdate",
"AppUpdate",
"PrivacyPro"
]
"$ref": "#/definitions/rmf-icon"
},
"primaryActionText": {
"type": "string"
Expand All @@ -149,5 +131,18 @@
}
]
}
},
"definitions": {
"rmf-icon": {
"title": "RMF Icon",
"type": "string",
"enum": [
"Announce",
"DDGAnnounce",
"CriticalUpdate",
"AppUpdate",
"PrivacyPro"
]
}
}
}
}
7 changes: 4 additions & 3 deletions special-pages/types/new-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type WidgetConfigs = WidgetConfigItem[];
*/
export type Widgets = WidgetListItem[];
export type RMFMessage = SmallMessage | MediumMessage | BigSingleActionMessage | BigTwoActionMessage;
export type RMFIcon = "Announce" | "DDGAnnounce" | "CriticalUpdate" | "AppUpdate" | "PrivacyPro";

/**
* Requests, Notifications and Subscriptions from the NewTab feature
Expand Down Expand Up @@ -157,22 +158,22 @@ export interface MediumMessage {
id: string;
titleText: string;
descriptionText: string;
icon: "Announce" | "DDGAnnounce" | "CriticalUpdate" | "AppUpdate" | "PrivacyPro";
icon: RMFIcon;
}
export interface BigSingleActionMessage {
messageType: "big_single_action";
id: string;
titleText: string;
descriptionText: string;
icon: "Announce" | "DDGAnnounce" | "CriticalUpdate" | "AppUpdate" | "PrivacyPro";
icon: RMFIcon;
primaryActionText: string;
}
export interface BigTwoActionMessage {
messageType: "big_two_action";
id: string;
titleText: string;
descriptionText: string;
icon: "Announce" | "DDGAnnounce" | "CriticalUpdate" | "AppUpdate" | "PrivacyPro";
icon: RMFIcon;
primaryActionText: string;
secondaryActionText: string;
}
Expand Down

0 comments on commit 001879b

Please sign in to comment.