Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missinng WindowNoUI #1

Open
mastrimax opened this issue Jul 30, 2024 · 3 comments
Open

missinng WindowNoUI #1

mastrimax opened this issue Jul 30, 2024 · 3 comments

Comments

@mastrimax
Copy link

I have noticed that the "WindowNoUI" component, which is mentioned in the documentation for usd_explorer and usd_composer, appears to be missing.
When I attempt to modify the code in web-viewer-sample/src/App.tsx from:
import Window from './Window';
to:
import Window from './WindowNoUI';
I encounter the following error:

[plugin:vite:import-analysis] Failed to resolve import "./WindowNoUI" from "src/App.tsx". Does the file exist?

Could you please confirm if the WindowNoUI file should be present in the project?
Thank you for your assistance.

Best regards,
Massimo

@Gango98
Copy link

Gango98 commented Jul 31, 2024

Hi Massimo,
I've the same problem. At the moment, I solved by writing my own 'WindowNoUI.tsx' by removing unuseful things from 'Window.tsx'.

I hope they will fix this. There are too many inconsistent things in these docs.

Here is the code:

/*
 * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
 *
 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
 * property and proprietary rights in and to this material, related
 * documentation and any modifications thereto. Any use, reproduction,
 * disclosure or distribution of this material and related documentation
 * without an express license agreement from NVIDIA CORPORATION or
 * its affiliates is strictly prohibited.
 */
import React from 'react';
import AppStream from './AppStream'; // Ensure .tsx extension if needed
import StreamConfig from '../stream.config.json';

interface AppState {
    gfnUser: string | null;
}

export default class App extends React.Component<{}, AppState> {


    constructor(props: {}) {
        super(props);

        this.state = {
            gfnUser: null
        }
    }

    /**
    * @function _onStreamStarted
    *
    * Send a request to open an asset when stream has started.
    */
    private _onStreamStarted(): void { }

    /**
    * @function _handleCustomEvent
    *
    * Handle message from stream.
    */
    private _handleCustomEvent(event: any): void { }

    /**
    * @function _handleAppStreamFocus
    *
    */
    private _handleAppStreamFocus(): void {
        console.log('User is interacting in streamed viewer');
    }

    /**
    * @function _handleAppStreamBlur
    *
    * Update state when AppStream is not in focus.
    */
    private _handleAppStreamBlur(): void {
        console.log('User is not interacting in streamed viewer');
    }

    render() {
        const streamConfig: any = StreamConfig.source === 'gfn' ? {
            ...StreamConfig[StreamConfig.source],
            source: StreamConfig.source,
            //@ts-ignore
            GFN: GFN
        } : {
            //@ts-ignore
            ...StreamConfig[StreamConfig.source],
            source: StreamConfig.source
        };


        return (
            <div
                style={{
                    position: 'absolute',
                    top: 0,
                    left: 0,
                    width: '100%',
                    height: '100%'
                }}
            >
                {/* Streamed app */}
                <AppStream
                    streamConfig={streamConfig}
                    onLoggedIn={(userId) => this.setState({ gfnUser: userId })}
                    onStarted={() => this._onStreamStarted()}
                    onFocus={() => this._handleAppStreamFocus()}
                    onBlur={() => this._handleAppStreamBlur()}
                    style={{
                        position: 'absolute',
                        left: 0,
                        top: 0,
                        height: `100%`,
                        width: `100%`,
                        visibility: this.state.gfnUser ? 'visible' : 'hidden'
                    }}
                    handleCustomEvent={(event) => this._handleCustomEvent(event)}
                />
            </div>
        );
    }
}

@mastrimax
Copy link
Author

Thanks so much Matteo

@toolmanson
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants