97 lines
4.6 KiB
Diff
97 lines
4.6 KiB
Diff
diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts
|
|
index 3ef5ca1..a634a9f 100644
|
|
--- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts
|
|
+++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts
|
|
@@ -301,2 +301,8 @@ configurationRegistry.registerConfiguration({
|
|
},
|
|
+ 'workbench.welcomePage.extraAnnouncements': {
|
|
+ scope: ConfigurationScope.MACHINE,
|
|
+ type: 'boolean',
|
|
+ default: true,
|
|
+ description: localize('workbench.welcomePage.extraAnnouncements', "When enabled, the get started page loads additional announcements from VSCodium's repository.")
|
|
+ },
|
|
'workbench.startupEditor': {
|
|
diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
|
|
index 46949b2..174e65f 100644
|
|
--- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
|
|
+++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
|
|
@@ -118,4 +118,8 @@ type GettingStartedActionEvent = {
|
|
type RecentEntry = (IRecentFolder | IRecentWorkspace) & { id: string };
|
|
+type AnnouncementEntry = { id: string, title: string, url: string };
|
|
|
|
const REDUCED_MOTION_KEY = 'workbench.welcomePage.preferReducedMotion';
|
|
+
|
|
+const BUILTIN_ANNOUNCEMENTS: AnnouncementEntry[] = [/* BUILTIN_ANNOUNCEMENTS */];
|
|
+
|
|
export class GettingStartedPage extends EditorPane {
|
|
@@ -152,2 +156,4 @@ export class GettingStartedPage extends EditorPane {
|
|
private gettingStartedList?: GettingStartedIndexList<IResolvedWalkthrough>;
|
|
+ private announcementList?: GettingStartedIndexList<AnnouncementEntry>;
|
|
+ private announcementData?: AnnouncementEntry[];
|
|
private featuredExtensionsList?: GettingStartedIndexList<IFeaturedExtension>;
|
|
@@ -804,2 +810,3 @@ export class GettingStartedPage extends EditorPane {
|
|
const gettingStartedList = this.buildGettingStartedWalkthroughsList();
|
|
+ const announcementList = await this.buildAnnouncementList();
|
|
|
|
@@ -815,3 +822,3 @@ export class GettingStartedPage extends EditorPane {
|
|
this.container.classList.remove('noWalkthroughs');
|
|
- reset(leftColumn, startList.getDomElement(), recentList.getDomElement());
|
|
+ reset(leftColumn, startList.getDomElement(), recentList.getDomElement(), announcementList.getDomElement());
|
|
reset(rightColumn, featuredExtensionList.getDomElement(), gettingStartedList.getDomElement());
|
|
@@ -820,3 +827,3 @@ export class GettingStartedPage extends EditorPane {
|
|
this.container.classList.add('noWalkthroughs');
|
|
- reset(leftColumn, startList.getDomElement(), recentList.getDomElement());
|
|
+ reset(leftColumn, startList.getDomElement(), announcementList.getDomElement());
|
|
reset(rightColumn, featuredExtensionList.getDomElement());
|
|
@@ -982,2 +989,51 @@ export class GettingStartedPage extends EditorPane {
|
|
|
|
+ private async buildAnnouncementList(): Promise<GettingStartedIndexList<AnnouncementEntry>> {
|
|
+ const renderAnnouncement = (announcement: AnnouncementEntry) => {
|
|
+ const { title, url } = announcement;
|
|
+ const li = $('li');
|
|
+
|
|
+ const anchor: HTMLLinkElement = $('a');
|
|
+ anchor.href = url;
|
|
+ anchor.innerText = title;
|
|
+ anchor.target = '_blank';
|
|
+ li.appendChild(anchor);
|
|
+
|
|
+ return li;
|
|
+ };
|
|
+
|
|
+ if (this.announcementList) { this.announcementList.dispose(); }
|
|
+
|
|
+ const announcementList = this.announcementList = new GettingStartedIndexList({
|
|
+ title: localize('announcements', "VSCodium Announcements"),
|
|
+ klass: 'announcements',
|
|
+ limit: 5,
|
|
+ empty: $('.empty-recent', {}, localize('noAnnouncements', "There are no current announcements.")),
|
|
+ renderElement: renderAnnouncement,
|
|
+ contextService: this.contextService
|
|
+ });
|
|
+
|
|
+ if (!this.announcementData) {
|
|
+ const showExtras = this.configurationService.getValue<boolean>('workbench.welcomePage.extraAnnouncements');
|
|
+
|
|
+ if (showExtras) {
|
|
+ const branch = this.productService.quality === 'insider' ? 'insider' : 'master';
|
|
+ const res = await fetch(`https://raw.githubusercontent.com/VSCodium/vscodium/${branch}/announcements-extra.json`);
|
|
+
|
|
+ if (res.ok) {
|
|
+ var extraAnnouncements = await res.json() as AnnouncementEntry[];
|
|
+
|
|
+ this.announcementData = [...extraAnnouncements, ...BUILTIN_ANNOUNCEMENTS];
|
|
+ } else {
|
|
+ this.announcementData = BUILTIN_ANNOUNCEMENTS;
|
|
+ }
|
|
+ } else {
|
|
+ this.announcementData = BUILTIN_ANNOUNCEMENTS;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ announcementList.setEntries(this.announcementData);
|
|
+
|
|
+ return announcementList;
|
|
+ }
|
|
+
|
|
private buildStartList(): GettingStartedIndexList<IWelcomePageStartEntry> {
|