Skip to content

Commit

Permalink
Update desktop-test-app and template to use iui-layouts (#300)
Browse files Browse the repository at this point in the history
* Update desktop-app and template to use iui-layouts

* Remove unnecessary css import

* Fix SignIn and ItwinSelect css

* CVE-2023-4863 - bump electron to 24.8.3

* Move PageLayout.Content into App.tsx

* Add TitleArea to SelectImodel and remove css

* Add TitleArea to Home/Itwin and remove unused css

* Add change file

* WIP Changes that removes more CSS vs last commit

* Add PageLayout.Content pad for Home & SelectImodel

* Fix noItwinFound css

* Add WIP changes to the template package

* Revert electron peerDep

* Revert change file for desktop-viewer-react

* Add PageLayout CSS to root template

* Bump react-scripts to fix localization bug

* Clean up css and code

* Update layout for selectItwin/IModel
  • Loading branch information
AnDuong249 authored Sep 21, 2023
1 parent 40c380a commit 8590398
Show file tree
Hide file tree
Showing 24 changed files with 423 additions and 565 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/cra-template-desktop-viewer",
"comment": "Update the app and components to use ITwinUI-layouts",
"type": "minor"
}
],
"packageName": "@itwin/cra-template-desktop-viewer"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/desktop-viewer-react",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/desktop-viewer-react"
}
182 changes: 159 additions & 23 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions packages/apps/desktop-viewer-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"@itwin/imodels-access-frontend": "^4.0.4",
"@itwin/itwinui-css": "^1.12.0",
"@itwin/itwinui-icons-react": "^2.4.0",
"@itwin/itwinui-layouts-css": "^0.2.0",
"@itwin/itwinui-layouts-react": "^0.2.0",
"@itwin/itwinui-react": "^2.12.0",
"@itwin/itwinui-variables": "^2.0.0",
"@itwin/measure-tools-react": "^0.13.0",
Expand All @@ -69,7 +71,7 @@
"@itwin/tree-widget-react": "^1.0.0",
"@itwin/webgl-compatibility": "^4.0.6",
"dotenv-flow": "^3.2.0",
"electron": "^24.6.5",
"electron": "^24.8.3",
"minimist": "^1.2.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -79,7 +81,7 @@
"redux": "^4.2.1"
},
"devDependencies": {
"@bentley/react-scripts": "^5.0.4",
"@bentley/react-scripts": "^5.0.5",
"@itwin/build-tools": "^4.0.6",
"@types/electron-devtools-installer": "^2.2.2",
"@types/minimist": "^1.2.2",
Expand Down
33 changes: 26 additions & 7 deletions packages/apps/desktop-viewer-test/src/frontend/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type { DesktopInitializerParams } from "@itwin/desktop-viewer-react";
import { useConnectivity } from "@itwin/desktop-viewer-react";
import { useDesktopViewerInitializer } from "@itwin/desktop-viewer-react";
import { PageLayout } from "@itwin/itwinui-layouts-react";
import { ThemeProvider } from "@itwin/itwinui-react";
import {
MeasurementActionToolbar,
Expand All @@ -14,7 +15,7 @@ import {
import { PropertyGridManager } from "@itwin/property-grid-react";
import { TreeWidget } from "@itwin/tree-widget-react";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom";

import type { ViewerSettings } from "../../common/ViewerConfig";
import { viewerRpcs } from "../../common/ViewerConfig";
Expand Down Expand Up @@ -85,12 +86,30 @@ const App = () => {
<ThemeProvider theme="dark" style={{ height: "100%" }}>
<SettingsContext.Provider value={{ settings, addRecent }}>
<BrowserRouter>
<Routes>
<Route path="/" element={<HomeRoute />} />
<Route path="/itwins/:iTwinId" element={<IModelsRoute />} />
<Route path="/itwins" element={<ITwinsRoute />} />
<Route path="/viewer" element={<ViewerRoute />} />
</Routes>
<PageLayout>
<Routes>
<Route
element={
<PageLayout.Content padded>
<Outlet />
</PageLayout.Content>
}
>
<Route path="/" element={<HomeRoute />} />
<Route path="/itwins/:iTwinId" element={<IModelsRoute />} />
<Route path="/itwins" element={<ITwinsRoute />} />
</Route>
<Route
element={
<PageLayout.Content>
<Outlet />
</PageLayout.Content>
}
>
<Route path="/viewer" element={<ViewerRoute />} />
</Route>
</Routes>
</PageLayout>
</BrowserRouter>
</SettingsContext.Provider>
</ThemeProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

.home-title {
padding: 100px 100px 50px 100px !important;
margin-top: var(--iui-size-m);
font-weight: 900;
}

.home {
display: grid;
grid-template-rows: 250px auto;
grid-template-columns: minmax(300px, 50%) 50%;
padding: 0 100px 100px 100px;
.home-section {
a,
span {
Expand Down Expand Up @@ -45,4 +44,4 @@
width: 100% !important;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "./Home.scss";
import { InternetConnectivityStatus } from "@itwin/core-common";
import { useConnectivity } from "@itwin/desktop-viewer-react";
import { SvgFolderOpened, SvgImodel } from "@itwin/itwinui-icons-react";
import { PageLayout } from "@itwin/itwinui-layouts-react";
import { Blockquote, Text } from "@itwin/itwinui-react";
import React, { useContext, useEffect, useState } from "react";
import { Link, useNavigate } from "react-router-dom";
Expand Down Expand Up @@ -55,10 +56,12 @@ const Home = () => {
};

return (
<div>
<Text className="home-title" variant="headline">
iTwin Viewer for Desktop
</Text>
<>
<PageLayout.TitleArea>
<Text className="home-title" variant="headline">
iTwin Viewer for Desktop
</Text>
</PageLayout.TitleArea>
<div className="home">
<div className="home-section start">
<Text variant="title"> {ITwinViewerApp.translate("home.start")}</Text>
Expand Down Expand Up @@ -99,7 +102,7 @@ const Home = () => {
<Recents />
</div>
</div>
</div>
</>
);
};

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import "./SelectIModel.scss";

import { BriefcaseConnection } from "@itwin/core-frontend";
import { getBriefcaseStatus, ModelStatus } from "@itwin/desktop-viewer-react";
import type { IModelFull, IModelGridProps } from "@itwin/imodel-browser-react";
import { IModelGrid } from "@itwin/imodel-browser-react";
import { PageLayout } from "@itwin/itwinui-layouts-react";
import type { TileProps } from "@itwin/itwinui-react";
import { Text } from "@itwin/itwinui-react";
import React, {
Expand Down Expand Up @@ -198,18 +197,17 @@ export const SelectIModel = ({
};

return (
<div className="itv-scrolling-container select-imodel">
<div className={"itv-content-margins"}>
<>
<PageLayout.TitleArea>
<Text variant="title">{`iModels for ${iTwinName}`}</Text>
</div>
<div className="itv-scrolling-content">
<IModelGrid
accessToken={accessToken}
iTwinId={iTwinId}
onThumbnailClick={selectIModel}
useIndividualState={useProgressIndicator}
/>
</div>
</div>
</PageLayout.TitleArea>

<IModelGrid
accessToken={accessToken}
iTwinId={iTwinId}
onThumbnailClick={selectIModel}
useIndividualState={useProgressIndicator}
/>
</>
);
};
Loading

0 comments on commit 8590398

Please sign in to comment.