Skip to content

add nwb assistant to home page of docs #2076

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/source/_static/css/nwb_assistant.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
.assistant-toggle {
display: none;
position: fixed;
right: 20px;
top: 20px;
z-index: 1001;
padding: 8px 16px;
background-color: #2980b9;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
}

/* Hide button when assistant is open */
.assistant-container.show ~ .assistant-toggle {
display: none !important;
}

.assistant-toggle:hover {
background-color: #3498db;
}

.assistant-container {
display: none;
}

@media (min-width: 1300px) {
.assistant-toggle {
display: block;
}

.assistant-container {
display: block;
visibility: hidden;
position: fixed;
right: 0;
top: 0;
width: calc(100vw - 1140px);
height: 100vh;
z-index: 1000;
transform: translateX(100%);
transition: transform 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.assistant-container.show {
visibility: visible;
transform: translateX(0);
}

.assistant-iframe {
width: 100%;
height: 100%;
border: none;
background: white;
}

.wy-nav-content {
transition: margin-right 0.3s ease-in-out;
}

.assistant-container.show ~ .wy-nav-content {
margin-right: calc(100vw - 1140px);
}
}
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def __call__(self, filename):
# or fully qualified paths (eg. https://...)
html_css_files = [
'css/custom.css',
'css/nwb_assistant.css'
]

# The name for this set of Sphinx documents. If None, it defaults to
Expand Down
24 changes: 24 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@ The NWB team consists of neuroscientists and software developers
who recognize that adoption of a unified data format is an important step toward
breaking down the barriers to data sharing in neuroscience.

.. raw:: html

<div class="assistant-container">
<iframe class="assistant-iframe"></iframe>
</div>
<button class="assistant-toggle">Open Assistant</button>
<script>
document.addEventListener('DOMContentLoaded', function() {
const toggle = document.querySelector('.assistant-toggle');
const container = document.querySelector('.assistant-container');
const iframe = document.querySelector('.assistant-iframe');
let iframeLoaded = false;

toggle.addEventListener('click', function() {
const isShowing = container.classList.toggle('show');

// Load iframe content only when first opened
if (isShowing && !iframeLoaded) {
iframe.src = 'https://magland.github.io/nwb-assistant/chat';
iframeLoaded = true;
}
});
});
</script>

.. toctree::
:maxdepth: 2
Expand Down
Loading