Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MBudreviciusBentley committed Dec 31, 2024
1 parent 6e98556 commit 52bd6bf
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 44 deletions.
36 changes: 18 additions & 18 deletions apps/test-app/src/routes/iTwin_.$iTwinId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { IModelGrid } from '@itwin/imodel-browser-react'
import { config } from '../frontend/config'
import { useAuth } from '../frontend/Auth'
import { PageLayout } from '@itwin/itwinui-layouts-react'
import { SignInPage } from '../frontend/SignInPage'
import React from "react";
import { createFileRoute, useNavigate } from "@tanstack/react-router";
import { IModelGrid } from "@itwin/imodel-browser-react";
import { config } from "../frontend/config";
import { useAuth } from "../frontend/Auth";
import { PageLayout } from "@itwin/itwinui-layouts-react";
import { SignInPage } from "../frontend/SignInPage";

export const Route = createFileRoute('/iTwin_/$iTwinId')({
export const Route = createFileRoute("/iTwin_/$iTwinId")({
component: ITwin,
})
});

const { serverEnvironmentPrefix } = config
const { serverEnvironmentPrefix } = config;
const apiOverrides = {
serverEnvironmentPrefix,
}
};

function ITwin() {
const { accessToken } = useAuth()
const { iTwinId } = Route.useParams()
const navigate = useNavigate()
if (!accessToken) return <SignInPage />
const { accessToken } = useAuth();
const { iTwinId } = Route.useParams();
const navigate = useNavigate();
if (!accessToken) return <SignInPage />;
return (
<PageLayout.Content padded={true}>
<IModelGrid
onThumbnailClick={(iModel) => {
void navigate({
to: '/iTwin/$iTwinId/iModel/$iModelId',
to: "/iTwin/$iTwinId/iModel/$iModelId",
params: { iTwinId, iModelId: iModel.id },
})
});
}}
iTwinId={iTwinId}
accessToken={accessToken}
apiOverrides={apiOverrides}
searchText=""
/>
</PageLayout.Content>
)
);
}
52 changes: 26 additions & 26 deletions apps/test-app/src/routes/local_.$fileName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,55 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react'
import { createFileRoute } from '@tanstack/react-router'
import { PageLayout } from '@itwin/itwinui-layouts-react'
import { config } from '../frontend/config'
import { SnapshotConnection } from '@itwin/core-frontend'
import { createViewState } from '../frontend/createViewState'
import { appInitializer } from '../frontend/AppInitializer'
import { App } from '../frontend/App'
import { UiFramework } from '@itwin/appui-react'
import React from "react";
import { createFileRoute } from "@tanstack/react-router";
import { PageLayout } from "@itwin/itwinui-layouts-react";
import { config } from "../frontend/config";
import { SnapshotConnection } from "@itwin/core-frontend";
import { createViewState } from "../frontend/createViewState";
import { appInitializer } from "../frontend/AppInitializer";
import { App } from "../frontend/App";
import { UiFramework } from "@itwin/appui-react";
import {
AppParams,
useFeatureOverrideParams,
useSyncFrontstageParam,
} from '../frontend/SearchParams'
import { registerFrontstages } from '../frontend/registerFrontstages'
} from "../frontend/SearchParams";
import { registerFrontstages } from "../frontend/registerFrontstages";

export const Route = createFileRoute('/local_/$fileName')({
export const Route = createFileRoute("/local_/$fileName")({
component: Local,
loader: async (ctx) => {
await appInitializer.initialize()
await appInitializer.initialize();

const filePath = `${config.bimDir}/${ctx.params.fileName}`
const iModelConnection = await SnapshotConnection.openFile(filePath)
const viewState = await createViewState(iModelConnection)
const filePath = `${config.bimDir}/${ctx.params.fileName}`;
const iModelConnection = await SnapshotConnection.openFile(filePath);
const viewState = await createViewState(iModelConnection);

registerFrontstages({ iModelConnection, viewState })
UiFramework.setIModelConnection(iModelConnection)
UiFramework.setDefaultViewState(viewState)
registerFrontstages({ iModelConnection, viewState });
UiFramework.setIModelConnection(iModelConnection);
UiFramework.setDefaultViewState(viewState);

return {
iModelConnection,
viewState,
}
};
},
validateSearch: (search: AppParams) => {
return search
return search;
},
shouldReload: (ctx) => {
return ctx.cause === 'enter'
return ctx.cause === "enter";
},
gcTime: 0,
})
});

function Local() {
useSyncFrontstageParam()
const featureOverrides = useFeatureOverrideParams()
useSyncFrontstageParam();
const featureOverrides = useFeatureOverrideParams();
return (
<PageLayout.Content>
<App featureOverrides={featureOverrides} />
</PageLayout.Content>
)
);
}

0 comments on commit 52bd6bf

Please sign in to comment.