mirror of
https://github.com/VSCodium/vscodium
synced 2024-08-28 13:29:51 +00:00
102 lines
4.6 KiB
Diff
102 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 8c2aa42..18b0975 100644
|
|
--- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts
|
|
+++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts
|
|
@@ -300,2 +300,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 9dd5330..9e2b6a2 100644
|
|
--- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
|
|
+++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
|
|
@@ -117,4 +117,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 {
|
|
@@ -153,2 +157,4 @@ export class GettingStartedPage extends EditorPane {
|
|
private gettingStartedList?: GettingStartedIndexList<IResolvedWalkthrough>;
|
|
+ private announcementList?: GettingStartedIndexList<AnnouncementEntry>;
|
|
+ private announcementData?: AnnouncementEntry[];
|
|
private featuredExtensionsList?: GettingStartedIndexList<IFeaturedExtension>;
|
|
@@ -774,2 +780,3 @@ export class GettingStartedPage extends EditorPane {
|
|
const gettingStartedList = this.buildGettingStartedWalkthroughsList();
|
|
+ const announcementList = await this.buildAnnouncementList();
|
|
|
|
@@ -784,3 +791,3 @@ export class GettingStartedPage extends EditorPane {
|
|
this.container.classList.remove('noWalkthroughs');
|
|
- reset(rightColumn, featuredExtensionList.getDomElement(), gettingStartedList.getDomElement());
|
|
+ reset(rightColumn, featuredExtensionList.getDomElement(), gettingStartedList.getDomElement(), announcementList.getDomElement());
|
|
}
|
|
@@ -788,3 +795,3 @@ export class GettingStartedPage extends EditorPane {
|
|
this.container.classList.add('noWalkthroughs');
|
|
- reset(rightColumn, featuredExtensionList.getDomElement());
|
|
+ reset(rightColumn, featuredExtensionList.getDomElement(), announcementList.getDomElement());
|
|
}
|
|
@@ -946,2 +953,55 @@ 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';
|
|
+ await fetch(`https://raw.githubusercontent.com/VSCodium/vscodium/${branch}/announcements-extra.json`)
|
|
+ .then(async res => {
|
|
+ if (res.ok) {
|
|
+ var extraAnnouncements = await res.json() as AnnouncementEntry[];
|
|
+
|
|
+ this.announcementData = [...extraAnnouncements, ...BUILTIN_ANNOUNCEMENTS];
|
|
+ } else {
|
|
+ this.announcementData = BUILTIN_ANNOUNCEMENTS;
|
|
+ }
|
|
+ })
|
|
+ .catch(err => {
|
|
+ this.announcementData = BUILTIN_ANNOUNCEMENTS;
|
|
+ });
|
|
+ } else {
|
|
+ this.announcementData = BUILTIN_ANNOUNCEMENTS;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ announcementList.setEntries(this.announcementData);
|
|
+
|
|
+ return announcementList;
|
|
+ }
|
|
+
|
|
private buildStartList(): GettingStartedIndexList<IWelcomePageStartEntry> {
|