From 7d7e8820b0e7142c2063e0b7063003194a0999df Mon Sep 17 00:00:00 2001 From: Matthew Buckett Date: Mon, 29 Jan 2024 16:38:25 +0000 Subject: [PATCH] Pull in newer ui-lti. This allows us to drop the LTIApplyTheme code as there's now a working version in the package. --- package-lock.json | 14 +++++++------- package.json | 2 +- src/App.jsx | 3 +-- src/LtiApplyTheme.jsx | 33 --------------------------------- 4 files changed, 9 insertions(+), 43 deletions(-) delete mode 100644 src/LtiApplyTheme.jsx diff --git a/package-lock.json b/package-lock.json index 380ca09..0d22282 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@instructure/ui-text": "^8.43.1", "@instructure/ui-themes": "^8.43.1", "@instructure/ui-view": "^8.43.1", - "@oxctl/ui-lti": "^1.4.4", + "@oxctl/ui-lti": "^1.5.1", "jwt-decode": "^3.1.2", "react": "^18.2.0", "react-dom": "^18.2.0" @@ -3436,9 +3436,9 @@ } }, "node_modules/@oxctl/ui-lti": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/@oxctl/ui-lti/-/ui-lti-1.4.4.tgz", - "integrity": "sha512-aL+j/1pg/mC9GsxihRLDoLAivj4IubXyaqUIRBCBcA2xCqL9sgjCOS7q0jND6CHF485qWloDVx6yRbfGD1cMXg==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@oxctl/ui-lti/-/ui-lti-1.5.1.tgz", + "integrity": "sha512-bM4Wit7hTLvai6y+Csxt0t8gh0/jiDnGg1PbDnwVWkApGlH+gOPJABcX8UPfKn2UMQuald5N3vsplN3HiGwhiQ==", "peerDependencies": { "@instructure/canvas-theme": ">= 7.0.0", "@instructure/emotion": ">= 7.0.0", @@ -6693,9 +6693,9 @@ } }, "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, "engines": { "node": "*" diff --git a/package.json b/package.json index cf1b694..bdd1b29 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "@instructure/ui-text": "^8.43.1", "@instructure/ui-themes": "^8.43.1", "@instructure/ui-view": "^8.43.1", - "@oxctl/ui-lti": "^1.4.4", + "@oxctl/ui-lti": "^1.5.1", "jwt-decode": "^3.1.2", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/src/App.jsx b/src/App.jsx index c4ced97..433fa4d 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,9 +1,8 @@ import React, {useState} from 'react' import jwtDecode from 'jwt-decode' -import {LtiHeightLimit, LtiTokenRetriever} from '@oxctl/ui-lti' +import {LtiHeightLimit, LtiTokenRetriever, LtiApplyTheme} from '@oxctl/ui-lti' import {Heading} from "@instructure/ui-heading"; import {Text} from "@instructure/ui-text" -import LtiApplyTheme from "./LtiApplyTheme.jsx"; import {View} from "@instructure/ui-view"; function App() { diff --git a/src/LtiApplyTheme.jsx b/src/LtiApplyTheme.jsx deleted file mode 100644 index 7a89805..0000000 --- a/src/LtiApplyTheme.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import {useEffect, useState} from 'react' -import {EmotionThemeProvider} from '@instructure/emotion' -import {canvas, canvasHighContrast} from '@instructure/ui-themes' - -function LtiApplyTheme({url, highContrast, children}) { - - const [theme, setTheme] = useState(null) - - const loadTheme = () => { - if (url) { - fetch(url) - .then(response => response.json()) - .then((json) => { - // Apply the loaded theme. - const newTheme = highContrast ? canvasHighContrast : {...canvas, ...json} - setTheme(newTheme) - }) - } - } - - useEffect(() => { - loadTheme() - }, []); - - return ( - - {children} - - ) - -} - -export default LtiApplyTheme