From 3b3abd2a3349d26cce94b929ad3a2eeba1576492 Mon Sep 17 00:00:00 2001 From: Alessio Occhipinti Date: Sun, 23 Dec 2018 17:35:38 +0100 Subject: [PATCH] Feat/sanity (#298) * chore: finishing sanity integration with correct schemas * chore: adding sanity client (waiting for bug fix from sanity) * feat: Sanity integration completed * chore: removed useless bootstrap type --- extensions/webviews/ReleaseNotes.ts | 7 +- extensions/webviews/interfaces.ts | 17 +- extensions/webviews/ui/release-notes/index.ts | 26 +- .../ui/release-notes/release-notes.html | 39 +- .../webviews/ui/release-notes/style.css | 1 - package.json | 1 + sanity/README.md | 9 - sanity/config/.checksums | 6 - sanity/config/@sanity/data-aspects.json | 3 - sanity/config/@sanity/default-layout.json | 6 - sanity/config/@sanity/default-login.json | 7 - sanity/package.json | 32 - sanity/plugins/.gitkeep | 1 - sanity/sanity.json | 23 - sanity/static/.gitkeep | 1 - sanity/static/favicon.ico | Bin 1150 -> 0 bytes sanity/yarn.lock | 6935 ----------------- typings/sanity/sanity.ts | 1 + yarn.lock | 200 +- 19 files changed, 232 insertions(+), 7083 deletions(-) delete mode 100644 sanity/README.md delete mode 100644 sanity/config/.checksums delete mode 100644 sanity/config/@sanity/data-aspects.json delete mode 100644 sanity/config/@sanity/default-layout.json delete mode 100644 sanity/config/@sanity/default-login.json delete mode 100644 sanity/package.json delete mode 100644 sanity/plugins/.gitkeep delete mode 100644 sanity/sanity.json delete mode 100644 sanity/static/.gitkeep delete mode 100644 sanity/static/favicon.ico delete mode 100644 sanity/yarn.lock create mode 100644 typings/sanity/sanity.ts diff --git a/extensions/webviews/ReleaseNotes.ts b/extensions/webviews/ReleaseNotes.ts index f4f6da7..ba650a8 100644 --- a/extensions/webviews/ReleaseNotes.ts +++ b/extensions/webviews/ReleaseNotes.ts @@ -2,9 +2,8 @@ import {WebviewController} from './Webview'; import { ExtensionContext } from 'vscode'; -import {ReleaseNotesBootstrap} from './interfaces'; -export class ReleaseNotesWebview extends WebviewController { +export class ReleaseNotesWebview extends WebviewController<{}> { constructor(context: ExtensionContext) { super(context); } @@ -26,8 +25,6 @@ export class ReleaseNotesWebview extends WebviewController sanityClient({ + projectId: 'v475t82f', + dataset: 'production' +}); + const getReleaseNotes = (): Promise => { - const uri = 'https://raw.githubusercontent.com/equinusocio/vsc-material-theme-releases/master/releases/index.json'; - return fetch(uri).then(res => res.json()); + const query = '*[_type == "release"] | order(_createdAt desc)'; + const client = getClient(); + return client.fetch(query); }; const renderTemplate = (posts: IPost[]) => { @@ -12,13 +20,19 @@ const renderTemplate = (posts: IPost[]) => {

${title}

    - ${fixed.reduce((accc, src) => accc.concat(`
  • ${src}
  • `), '')} - ${newItems.reduce((accc, src) => accc.concat(`
  • ${src}
  • `), '')} - ${breaking.reduce((accc, src) => accc.concat(`
  • ${src}
  • `), '')} + ${fixed.reduce((accc: string, src) => accc.concat(`
  • ${src}
  • `), '')} + ${newItems.reduce((accc: string, src) => accc.concat(`
  • ${src}
  • `), '')} + ${breaking.reduce((accc: string, src) => accc.concat(`
  • ${src}
  • `), '')}
`), '')}`; }; getReleaseNotes().then((res: IPost[]) => { - document.querySelector('.Container').innerHTML = renderTemplate(res); + const normalized = res.reduce((acc, src) => acc.concat({ + ...src, + fixed: src.fixed ? src.fixed.map(item => item.children[0].text) : [], + new: src.new ? src.new.map(item => item.children[0].text) : [], + breaking: src.breaking ? src.breaking.map(item => item.children[0].text) : [] + }), []); + document.querySelector('.Container').innerHTML = renderTemplate(normalized); }); diff --git a/extensions/webviews/ui/release-notes/release-notes.html b/extensions/webviews/ui/release-notes/release-notes.html index 650bbe3..2e29316 100644 --- a/extensions/webviews/ui/release-notes/release-notes.html +++ b/extensions/webviews/ui/release-notes/release-notes.html @@ -11,44 +11,7 @@
-
-
- 2.4.2 -

August 30, 2018

-
-
    -
  • Fix missing commands
  • -
-
- -
-
- 2.4.1 -

August 30, 2018

-
-
    -
  • Fix new settings view colors for Code <= 1.26.0
  • -
-
- -
-
- 2.4.0 -

August 29, 2018

-
-
    -
  • New file icons auto applying and notifications behaviors
  • -
  • Many UI fixes and small improvements
  • -
  • General colors and contrast
  • -
  • Fix color contrast for hovered custom menu items (Win/Lin)
  • -
  • New file icons
  • -
  • Support for custom menus (Windows/Linux)
  • -
  • Support for the editor breadcrumb
  • -
  • Support for editor new settings view
  • -
  • Add new Release Notes command
  • -
  • Add icons to root folders
  • -
-
+
Loading...