Skip to content

Commit

Permalink
add styles to navbar module to make it sticky and visible when scroll…
Browse files Browse the repository at this point in the history
…ing down the notebook
  • Loading branch information
marwan37 committed Jan 25, 2024
1 parent 47f174e commit bdb7e5b
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/components/Dashboard/tree/LeftSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export default function LeftSidebar({ username, refetch, handleSelectedDocId }:
position: 'fixed',
left: 0,
backgroundColor: theme === 'dark' ? '#121212' : '#fafafa',

zIndex: 5
}}>
{isExpanded && (
Expand Down
7 changes: 6 additions & 1 deletion src/components/Dashboard/tree/NotebookTreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ export default function NotebookTreeView({
<>
<div style={{ display: 'flex', alignItems: 'center', padding: '0px 12px', justifyContent: 'space-between' }}>
<h3>Workspace</h3>
<Switch checkedChildren='Dark' unCheckedChildren='Light' checked={theme === 'dark'} onChange={toggleTheme} />
<Switch
checkedChildren='Dark'
unCheckedChildren='Light'
checked={theme === 'dark'}
onChange={toggleTheme}
/>
</div>
<Tree
defaultExpandAll
Expand Down
3 changes: 3 additions & 0 deletions src/components/Notebook/navbar/Navbar.module.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
.header {
display: flex;
position: sticky;
align-items: center;
justify-content: space-between;
padding: 0 24px;
top: 0;
height: 64px;
z-index: 1000;
}

.header > * {
Expand Down
86 changes: 86 additions & 0 deletions websocket-load-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
config:
target: 'wss://hp.mafishi.io/collab'
phases:
- duration: 60
arrivalRate: 5
rampTo: 20
name: 'Ramping up the load'
- duration: 120
arrivalRate: 20
name: 'Sustained load'
ws:
# Replace with actual token if required
headers:
Authorization: 'Bearer YOUR_ACCESS_TOKEN'

scenarios:
- name: 'WebSocket Connection and Interaction'
flow:
- loop:
- function: 'connectWebSocket'
- think: 5
- function: 'editMarkdownCell'
- think: 10
- function: 'editCodeCell'
- think: 15
- function: 'navigateDashboard'
- think: 5
count: 10

- name: 'Concurrent Editing Simulation'
flow:
- loop:
- function: 'connectWebSocket'
- think: 5
- function: 'concurrentEditCell'
- think: 10
count: 20

- name: 'Connection Stability Test'
flow:
- loop:
- function: 'connectWebSocket'
- think: 2
- function: 'disconnectWebSocket'
- think: 1
count: 30

# Custom functions simulating different user actions
functions:
connectWebSocket:
# JavaScript function to establish WebSocket connection using Hocuspocus provider
js: |
function(context, events, done) {
var docID = '9c93ccb1-6154-4a05-a6c8-903d092d2956';
var url = `wss://hp.mafishi.io/collab/${docID}`;
var token = 'super-secret-token';
context.ws.connect(url, {
headers: {
Authorization: `Bearer ${token}`
},
onOpen: function(socket) {
console.log('WebSocket connection opened');
// Store the WebSocket connection in the context for other functions to use
context.ws = socket;
done();
},
onClose: function() {
console.log('WebSocket connection closed');
},
onError: function(error) {
console.error('WebSocket error:', error);
done(error);
}
});
}
editMarkdownCell:
# Add logic to simulate editing a markdown cell
editCodeCell:
# Add logic to simulate editing a code cell
navigateDashboard:
# Add logic to simulate dashboard navigation
concurrentEditCell:
# Add logic to simulate concurrent editing of a cell
disconnectWebSocket:
# Add logic to disconnect the WebSocket

0 comments on commit bdb7e5b

Please sign in to comment.