diff --git a/lms/static/images/hypothesis-logo.svg b/lms/static/images/hypothesis-logo.svg deleted file mode 100644 index d27ca9b21e..0000000000 --- a/lms/static/images/hypothesis-logo.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/lms/static/scripts/frontend_apps/components/dashboard/DashboardApp.tsx b/lms/static/scripts/frontend_apps/components/dashboard/DashboardApp.tsx index d9e7e56800..649b271a34 100644 --- a/lms/static/scripts/frontend_apps/components/dashboard/DashboardApp.tsx +++ b/lms/static/scripts/frontend_apps/components/dashboard/DashboardApp.tsx @@ -1,29 +1,65 @@ +import { + Link, + LogoIcon, + ProfileIcon, + SettingsIcon, +} from '@hypothesis/frontend-shared'; import classnames from 'classnames'; -import { Route, Switch, useParams } from 'wouter-preact'; +import { Link as RouterLink, Route, Switch, useParams } from 'wouter-preact'; +import { useConfig } from '../../config'; import AssignmentActivity from './AssignmentActivity'; import CourseActivity from './CourseActivity'; import DashboardFooter from './DashboardFooter'; import OrganizationActivity from './OrganizationActivity'; export default function DashboardApp() { + const { dashboard } = useConfig(['dashboard']); const { organizationPublicId } = useParams<{ organizationPublicId: string; }>(); return (
-
- Hypothesis logo +
+
+ + + + +
+ + + {dashboard.user.display_name} + + { + e.preventDefault(); + alert('This is not implemented yet'); + } + } + > + + Settings + +
+
diff --git a/lms/static/scripts/frontend_apps/components/dashboard/DashboardFooter.tsx b/lms/static/scripts/frontend_apps/components/dashboard/DashboardFooter.tsx index c6ee8cbff5..cccfbd5379 100644 --- a/lms/static/scripts/frontend_apps/components/dashboard/DashboardFooter.tsx +++ b/lms/static/scripts/frontend_apps/components/dashboard/DashboardFooter.tsx @@ -1,5 +1,5 @@ import type { LinkProps } from '@hypothesis/frontend-shared'; -import { Link } from '@hypothesis/frontend-shared'; +import { Link, LogoIcon } from '@hypothesis/frontend-shared'; function FooterLink( props: Omit, @@ -23,11 +23,7 @@ export default function DashboardFooter() {
- Hypothesis logo + hypothes.is
diff --git a/lms/static/scripts/frontend_apps/components/dashboard/test/DashboardApp-test.js b/lms/static/scripts/frontend_apps/components/dashboard/test/DashboardApp-test.js index c648f4f009..a41863953a 100644 --- a/lms/static/scripts/frontend_apps/components/dashboard/test/DashboardApp-test.js +++ b/lms/static/scripts/frontend_apps/components/dashboard/test/DashboardApp-test.js @@ -4,10 +4,21 @@ import { } from '@hypothesis/frontend-testing'; import { mount } from 'enzyme'; +import { Config } from '../../../config'; import DashboardApp, { $imports } from '../DashboardApp'; describe('DashboardApp', () => { + let fakeConfig; + beforeEach(() => { + fakeConfig = { + dashboard: { + user: { + display_name: 'John Doe', + }, + }, + }; + $imports.$mock(mockImportedComponents()); }); @@ -16,9 +27,25 @@ describe('DashboardApp', () => { }); function createComponent() { - return mount(); + return mount( + + + , + ); } + ['John Doe', 'Jane Doe', 'Foobar'].forEach(displayName => { + it('shows expected username', () => { + fakeConfig.dashboard.user.display_name = displayName; + const wrapper = createComponent(); + + assert.equal( + wrapper.find('[data-testid="display-name"]').text(), + displayName, + ); + }); + }); + it( 'should pass a11y checks', checkAccessibility({ diff --git a/lms/static/scripts/frontend_apps/config.ts b/lms/static/scripts/frontend_apps/config.ts index b07cb873d4..0cd30486ed 100644 --- a/lms/static/scripts/frontend_apps/config.ts +++ b/lms/static/scripts/frontend_apps/config.ts @@ -248,8 +248,14 @@ export type DashboardRoutes = { organization_courses: string; }; +export type DashboardUser = { + is_staff: boolean; + display_name: string; +}; + export type DashboardConfig = { routes: DashboardRoutes; + user: DashboardUser; }; /** @@ -276,11 +282,6 @@ export type ConfigObject = { debug?: DebugInfo; product: Product; - // Only present when an LTI user is logged-in - user?: { - display_name: string; - }; - // Only present in "basic-lti-launch" mode. canvas: { // Only present in Canvas.