Skip to content

Commit cceafe9

Browse files
maglandrlystephprince
authored
add nwb assistant to home page of docs (#2076)
* add nwb assistant to home page of docs * update CHANGELOG --------- Co-authored-by: Ryan Ly <[email protected]> Co-authored-by: Steph Prince <[email protected]>
1 parent b6142fa commit cceafe9

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
- Fixed missing `__nwbfields__` and `_fieldsname` for `NWBData` and its subclasses. @rly [#2082](https://github.com/NeurodataWithoutBorders/pynwb/pull/2082)
2424
- Fixed caching of the type map when using HDMF 4.1.0. @rly [#2087](https://github.com/NeurodataWithoutBorders/pynwb/pull/2087)
2525

26+
### Documentation and tutorial enhancements
27+
- Added NWB AI assistant to the home page of the documentation. @magland [#2076](https://github.com/NeurodataWithoutBorders/pynwb/pull/2076)
28+
2629
## PyNWB 3.0.0 (February 26, 2025)
2730

2831
### Breaking changes
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.assistant-toggle {
2+
display: none;
3+
position: fixed;
4+
right: 20px;
5+
top: 20px;
6+
z-index: 1001;
7+
padding: 8px 16px;
8+
background-color: #2980b9;
9+
color: white;
10+
border: none;
11+
border-radius: 4px;
12+
cursor: pointer;
13+
font-size: 14px;
14+
}
15+
16+
/* Hide button when assistant is open */
17+
.assistant-container.show ~ .assistant-toggle {
18+
display: none !important;
19+
}
20+
21+
.assistant-toggle:hover {
22+
background-color: #3498db;
23+
}
24+
25+
.assistant-container {
26+
display: none;
27+
}
28+
29+
@media (min-width: 1300px) {
30+
.assistant-toggle {
31+
display: block;
32+
}
33+
34+
.assistant-container {
35+
display: block;
36+
visibility: hidden;
37+
position: fixed;
38+
right: 0;
39+
top: 0;
40+
width: calc(100vw - 1140px);
41+
height: 100vh;
42+
z-index: 1000;
43+
transform: translateX(100%);
44+
transition: transform 0.3s ease-in-out, visibility 0.3s ease-in-out;
45+
}
46+
47+
.assistant-container.show {
48+
visibility: visible;
49+
transform: translateX(0);
50+
}
51+
52+
.assistant-iframe {
53+
width: 100%;
54+
height: 100%;
55+
border: none;
56+
background: white;
57+
}
58+
59+
.wy-nav-content {
60+
transition: margin-right 0.3s ease-in-out;
61+
}
62+
63+
.assistant-container.show ~ .wy-nav-content {
64+
margin-right: calc(100vw - 1140px);
65+
}
66+
}

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ def __call__(self, filename):
263263
# or fully qualified paths (eg. https://...)
264264
html_css_files = [
265265
'css/custom.css',
266+
'css/nwb_assistant.css'
266267
]
267268

268269
# The name for this set of Sphinx documents. If None, it defaults to

docs/source/index.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,30 @@ The NWB team consists of neuroscientists and software developers
2020
who recognize that adoption of a unified data format is an important step toward
2121
breaking down the barriers to data sharing in neuroscience.
2222

23+
.. raw:: html
24+
25+
<div class="assistant-container">
26+
<iframe class="assistant-iframe"></iframe>
27+
</div>
28+
<button class="assistant-toggle">Open Assistant</button>
29+
<script>
30+
document.addEventListener('DOMContentLoaded', function() {
31+
const toggle = document.querySelector('.assistant-toggle');
32+
const container = document.querySelector('.assistant-container');
33+
const iframe = document.querySelector('.assistant-iframe');
34+
let iframeLoaded = false;
35+
36+
toggle.addEventListener('click', function() {
37+
const isShowing = container.classList.toggle('show');
38+
39+
// Load iframe content only when first opened
40+
if (isShowing && !iframeLoaded) {
41+
iframe.src = 'https://magland.github.io/nwb-assistant/chat';
42+
iframeLoaded = true;
43+
}
44+
});
45+
});
46+
</script>
2347

2448
.. toctree::
2549
:maxdepth: 2

0 commit comments

Comments
 (0)