Skip to content

Commit

Permalink
UI Refresh: Apps, LeftDrawer, themed Typography, reorg; Hot-reload es…
Browse files Browse the repository at this point in the history
…build and more (#1271)

* cypress: skip broken tests. tracked in issue #1269

* cypress: skip another test. tracked in issue #1269

* checkpoint

* apps: url state.  sidebar: title padding cleanup. controlbutton: tooltips fixed. notes: avatar valign top, dateline linebreaks.

* tests passing.

* tests passing.

* layout: working in landscape; checkpoint

* layout: left side aligned

* unit tests pass

* lint passes

* versions: move fetch logic to hook, more testing

* SideDrawer: mobile bottom drawer mostly working

* cypress passing

* cypress passinger

* cypress passingerer

* Delete api.min.js

---------

Signed-off-by: Pablo Mayrgundter <[email protected]>
  • Loading branch information
pablo-mayrgundter authored Dec 4, 2024
1 parent 4408e87 commit 77f8aee
Show file tree
Hide file tree
Showing 158 changed files with 3,511 additions and 2,156 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = {
'react',
'jsx-a11y',
'jsdoc',
'eslint-plugin-react-compiler',
],
rules: {
'arrow-parens': ['error', 'always'],
Expand Down Expand Up @@ -101,6 +102,7 @@ module.exports = {
'react/jsx-tag-spacing': ['error', {beforeSelfClosing: 'never'}],
'react/prop-types': 'off',
'react/self-closing-comp': 'error',
// TODO(pablo): re-enable.. got this down to 10. 'react-compiler/react-compiler': 'error',
'require-await': 'error',
'semi': ['error', 'never'],
'space-infix-ops': ['error'],
Expand Down
4 changes: 2 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ module.exports = import('./tools/esbuild/vars.cypress.js').then(({
env: {
// Used in support/models.js to setup intercepts, should match what code
// under tests will be using.
// TODO(pablo): cypress chrome seems to not have OPFS, so using original
// instead of RAW_GIT_PROXY_URL_NEW
AUTH0_DOMAIN: vars.AUTH0_DOMAIN,
GITHUB_BASE_URL: vars.GITHUB_BASE_URL,
GITHUB_BASE_URL_UNAUTHENTICATED: vars.GITHUB_BASE_URL_UNAUTHENTICATED,
MSW_IS_ENABLED: true,
OAUTH2_CLIENT_ID: vars.OAUTH2_CLIENT_ID,
// TODO(pablo): cypress chrome seems to not have OPFS, so using original
// instead of RAW_GIT_PROXY_URL_NEW
RAW_GIT_PROXY_URL: vars.RAW_GIT_PROXY_URL,
RAW_GIT_PROXY_URL_NEW: vars.RAW_GIT_PROXY_URL_NEW,
},
Expand Down
17 changes: 0 additions & 17 deletions cypress/e2e/appStore/appStore.cy.js

This file was deleted.

17 changes: 17 additions & 0 deletions cypress/e2e/apps/apps.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('apps side drawer', () => {
context('enable/disable feature using url parameter', () => {
beforeEach(() => {
cy.setCookie('isFirstTime', '1')
cy.visit('/')
})

it('should not show apps icon when url parameter is not present', () => {
cy.findByRole('button', {name: /Open Apps/}).should('not.exist')
})

it.skip('should show apps icon when url parameter is present', () => {
cy.routerNavigate('/share/v/p?feature=apps', {replace: true})
cy.findByRole('button', {name: /Open Apps/}).should('exist')
})
})
})
3 changes: 2 additions & 1 deletion cypress/e2e/notes-100/access-notes-list.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@percy/cypress'
import {TITLE_NOTES} from '../../../src/Components/Notes/component'
import {homepageSetup, returningUserVisitsHomepageWaitForModel} from '../../support/utils'


Expand All @@ -11,7 +12,7 @@ describe('Notes 100: Access notes list', () => {
beforeEach(() => cy.get('[data-testid="control-button-notes"]').click())
it('Notes visible - Screen', () => {
cy.get('[data-testid="list-notes"]')
cy.get('[data-testid="panelTitle"]').contains('NOTES')
cy.get(`[data-testid="PanelTitle-${TITLE_NOTES}"]`).contains(TITLE_NOTES)
})
})
})
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/notes-100/access-shared-note.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@percy/cypress'
import {TITLE_NOTE, TITLE_NOTES} from '../../../src/Components/Notes/component'
import {waitForModel, homepageSetup, setIsReturningUser} from '../../support/utils'

/** {@link https://github.com/bldrs-ai/Share/issues/1072} */
Expand All @@ -13,8 +14,7 @@ describe('Notes 100: Access shared note', () => {
waitForModel()
})
it('Notes open - Screen', () => {
// Panel title to contain 'NOTES' string
cy.get('[data-testid="panelTitle"]').contains('NOTES')
cy.get(`[data-testid="PanelTitle-${TITLE_NOTES}"]`).contains(TITLE_NOTES)
// List of notes to be visible
cy.get('.MuiList-root').should('exist')
cy.percySnapshot()
Expand All @@ -27,7 +27,7 @@ describe('Notes 100: Access shared note', () => {
})

it('Panel title to contain NOTE string and back button', () => {
cy.get('[data-testid="panelTitle"]').contains('NOTE')
cy.get(`[data-testid="PanelTitle-${TITLE_NOTE}"]`).contains(TITLE_NOTE)
cy.get('[data-testid="Back to the list"]').should('exist')
})

Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/notes-100/create-a-note.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@percy/cypress'
import {TITLE_NOTE_ADD} from '../../../src/Components/Notes/component'
import {
auth0Login,
homepageSetup,
Expand All @@ -19,7 +20,7 @@ describe('Notes 100: Create a note', () => {
it('Notes list switches to display only create note card and back to the list when nav backbutton is pressed', () => {
cy.get('[data-testid="Back to the list"]').should('exist')
cy.get('[placeholder="Note Title"]').should('exist')
cy.get('[data-testid="panelTitle"]').contains('ADD A NOTE')
cy.get(`[data-testid="PanelTitle-${TITLE_NOTE_ADD}"]`).contains(TITLE_NOTE_ADD)
cy.percySnapshot()
cy.get('[data-testid="Back to the list"]').click()
cy.get('[data-testid="list-notes"]').should('exist')
Expand Down
5 changes: 4 additions & 1 deletion cypress/e2e/notes-100/select-a-note.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@percy/cypress'
import {TITLE_NOTE} from '../../../src/Components/Notes/component'
import {
homepageSetup,
returningUserVisitsHomepageWaitForModel,
Expand All @@ -22,7 +23,9 @@ describe('Notes 100: Select a note', () => {
cy.get('[data-testid="list-notes"] > :nth-child(4) > [data-testid="note-card"] p').contains('testComment_1')
cy.get('[data-testid="list-notes"] > :nth-child(5) > [data-testid="note-card"] p').contains('testComment_2')

cy.get('[data-testid="panelTitle"]').should('have.text', 'NOTE')
cy.get(`[data-testid="PanelTitle-${TITLE_NOTE}"]`).debug()

cy.get(`[data-testid="PanelTitle-${TITLE_NOTE}"]`).should('have.text', TITLE_NOTE)

cy.get('[data-testid="Back to the list"]').click()

Expand Down
9 changes: 5 additions & 4 deletions cypress/e2e/open/100/open-model-dialog.cy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import '@percy/cypress'
import {LABEL_GITHUB} from '../../../../src/Components/Open/component'
import {
auth0Login,
homepageSetup,
returningUserVisitsHomepageWaitForModel,
} from '../../../support/utils'
import {
setupVirtualPathIntercept,
waitForModelReady,
} from '../../../support/models'
setupVirtualPathIntercept,
waitForModelReady,
} from '../../../support/models'


/** {@link https://github.com/bldrs-ai/Share/issues/1159}*/
Expand Down Expand Up @@ -47,7 +48,7 @@ describe('Open 100: Open model dialog', () => {
const interceptTag = 'ghOpenModelLoad'
it('Choose the path to the model on GitHub -> model is loaded into the scene', () => {
cy.get('[data-testid="tab-github"]').click()
cy.findByText('Github').click()
cy.findByText(LABEL_GITHUB).click()
cy.findByLabelText('Organization', {timeout: 5000}).click()
cy.contains('@cypresstester').click()
cy.findByLabelText('Repository', {timeout: 5000}).eq(0).click()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ run_cy_spec() {
echo "Running cypress specs in parallel..."

# Misc
run_cy_spec misc cypress/e2e/appStore,cypress/e2e/hide-feat,cypress/e2e/home,cypress/e2e/ifc-model,cypress/e2e/integration
run_cy_spec misc cypress/e2e/apps,cypress/e2e/hide-feat,cypress/e2e/home,cypress/e2e/ifc-model,cypress/e2e/integration

# Then conventional
for EPIC in create-100 open notes-100 profile-100 versions-100 view-100 ; do
Expand Down
9 changes: 5 additions & 4 deletions cypress/e2e/placemarks-100/marker-selection.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '@percy/cypress'
import {Raycaster, Vector2, Vector3} from 'three'
import {TITLE_NOTES} from '../../../src/Components/Notes/component'
import {homepageSetup,
returningUserVisitsHomepageWaitForModel,
auth0Login,
Expand All @@ -18,13 +19,13 @@ describe('Placemarks 100: Not visible when notes is not open', () => {
beforeEach(() => {
cy.get('[data-testid="control-button-notes"]').click()
cy.get('[data-testid="list-notes"]')
cy.get('[data-testid="panelTitle"]').contains('NOTES')

cy.get(`[data-testid="PanelTitle-${TITLE_NOTES}"]`).contains(TITLE_NOTES)
cy.window().then((window) => {
win = window
})
// eslint-disable-next-line cypress/no-unnecessary-waiting, no-magic-numbers
cy.wait(1000)
const waitTimeMs = 1000
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(waitTimeMs)
})
it('should select a marker and url hash should change', () => {
const {markerObjects, camera, domElement} = win.markerScene
Expand Down
20 changes: 10 additions & 10 deletions cypress/e2e/placemarks-100/marker-visibility.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@percy/cypress'
import {TITLE_NOTES} from '../../../src/Components/Notes/component'
import {homepageSetup, returningUserVisitsHomepageWaitForModel} from '../../support/utils'


Expand All @@ -8,23 +9,22 @@ describe('Placemarks 100: Not visible when notes is not open', () => {
context('Returning user visits homepage', () => {
beforeEach(returningUserVisitsHomepageWaitForModel)
it('MarkerControl should not exist', () => {
cy.get('[data-testid="markerControl"]').should('not.exist')
cy.get('[data-testid="markerControl"]').should('not.exist')
})

context('Open Notes and MarkerControl should exist', () => {
let win
let win
beforeEach(() => {
cy.get('[data-testid="control-button-notes"]').click()

cy.get('[data-testid="list-notes"]')
cy.get('[data-testid="panelTitle"]').contains('NOTES')

cy.get(`[data-testid="PanelTitle-${TITLE_NOTES}"]`).contains(TITLE_NOTES)
cy.window().then((window) => {
win = window
win = window
})
// eslint-disable-next-line cypress/no-unnecessary-waiting, no-magic-numbers
cy.wait(1500)
})
const waitTimeMs = 1500
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(waitTimeMs)
})
it('MarkerControl should exist', () => {
// Access the scene objects
const markers = win.markerScene.markerObjects
Expand All @@ -34,7 +34,7 @@ describe('Placemarks 100: Not visible when notes is not open', () => {

// Check visibility of markers
markers.forEach((marker) => {
// eslint-disable-next-line no-unused-expressions
// eslint-disable-next-line no-unused-expressions
expect(marker.userData.id).to.exist
})

Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/view-100/access-element-properties.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@percy/cypress'
import {TITLE} from '../../../src/Components/Properties/component'
import {
homepageSetup,
setIsReturningUser,
Expand Down Expand Up @@ -26,7 +27,7 @@ describe('View 100: Access elements property', () => {

it('Side drawer containing properties shall be visible', () => {
cy.get('[data-testid="control-button-properties"]').should('be.visible')
cy.get('[data-testid="panelTitle"]').contains('PROPERTIES')
cy.get(`[data-testid="PanelTitle-${TITLE}"]`).contains(TITLE)
cy.percySnapshot()
})
})
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bldrs",
"version": "1.0.1165",
"version": "1.0.1181",
"main": "src/index.jsx",
"license": "AGPL-3.0",
"homepage": "https://github.com/bldrs-ai/Share",
Expand Down Expand Up @@ -67,12 +67,13 @@
"@bldrs-ai/ifclib": "5.3.3",
"@emotion/react": "11.10.0",
"@emotion/styled": "11.10.0",
"@fontsource/roboto": "^5.1.0",
"@iconscout/react-unicons": "2.0.0",
"@mui/icons-material": "5.11.9",
"@mui/icons-material": "5.16.8",
"@mui/lab": "5.0.0-alpha.95",
"@mui/material": "5.10.1",
"@mui/styled-engine": "5.10.1",
"@mui/styles": "5.11.13",
"@mui/material": "5.16.8",
"@mui/styled-engine": "5.16.8",
"@mui/styles": "5.16.8",
"@octokit/rest": "20.1.1",
"@sentry/react": "7.61.0",
"@sentry/tracing": "7.61.0",
Expand All @@ -88,6 +89,7 @@
"esbuild-copy-static-files": "0.1.0",
"esbuild-plugin-progress": "1.0.1",
"esbuild-plugin-svgr": "2.0.0",
"eslint-plugin-react-compiler": "^19.0.0-beta-df7b47d-20241124",
"html-webpack-plugin": "5.5.3",
"js-cookie": "3.0.5",
"material-ui-popup-state": "5.0.4",
Expand Down Expand Up @@ -127,7 +129,6 @@
"@testing-library/dom": "8.19.1",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "13.4.0",
"@testing-library/react-hooks": "8.0.1",
"@tsconfig/recommended": "1.0.1",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
Expand Down
Binary file added public/icons/mod_logo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions public/mod.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html>
<head>
<script src="https://unpkg.com/[email protected]/dist/api.min.js"></script>
</head>
<body>
<table>
<tr>
<td>
<iframe src="/" width="1024" height="768" id="share-app"></iframe>
</td>
<td valign="top">
<!-- <button onclick="window.start()">start</button> -->
<div id="log"><ul id="logItems"></ul></div>
</td>
</tr>
</table>
<script src="mod.js" type="text/javascript"></script>
</body>
65 changes: 65 additions & 0 deletions public/mod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const {ClientWidgetApi, PostmessageTransport} = mxwidgets()


/** @param {string} msg */
function log(msg) {
const logElt = document.getElementById('logItems')
logElt.innerHTML += `<li>${msg}</li>`
}

// Define the widget configuration
const widget = {
id: 'bldrs-share',
name: 'Embedded Share App',
type: 'm.custom',
url: 'https://example.com/widget',
creatorUserId: '@user:matrix.org',
origin: '*',
}

// Reference the iframe element
const iframe = document.getElementById('share-app')

// Create a PostmessageTransport driver
const driver = new PostmessageTransport(window, iframe.contentWindow)

// Instantiate the ClientWidgetApi
const clientWidgetApi = new ClientWidgetApi(widget, iframe, driver)

console.log('clientWidgetApi', clientWidgetApi)

clientWidgetApi.on('ready', () => {
console.log('ON READY')
clientWidgetApi.updateVisibility(true).then(() => console.log('Widget knows it is visible now'))
// clientWidgetApi.transport.send('com.example.my_action', {isExample: true})
})

/** @param {string} eventName */
function register(eventName, cb) {
console.log('registering:', eventName)
clientWidgetApi.on(`action:ai.bldrs-share.${eventName}`, (event) => {
cb(eventName, event)
// clientWidgetApi.transport.reply(event, {success: true, response: 'Acknowledged!'})
})
}

const events = [
'ChangeViewSettings',
'HiddenElements',
'ModelLoaded',
'ChangeViewSettings',
'LoadModel',
'HighlightElements',
'SelectElements',
'UnhideElements',
'HideElements',
]
events.forEach((name) => {
register(name, (eventName, e) => console.log(`HANDLER ON ${eventName}:`, e.detail))
})

register('SelectionChanged', (eventName, e) => {
const data = e.detail.data
const currentSelection = data.current[0]
log(`GUID: ${currentSelection}`)
})
Loading

0 comments on commit 77f8aee

Please sign in to comment.