-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] improve landing page experience (#25)
- Loading branch information
1 parent
b00ae42
commit c8cccb5
Showing
8 changed files
with
144 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
@import tech.catheu.jnotebook.Main.InteractiveConfiguration | ||
@import tech.catheu.jnotebook.server.HtmlTemplateEngine.TemplateModel | ||
@import tech.catheu.jnotebook.server.HtmlTemplateEngine.TemplateData | ||
@import java.nio.file.Path | ||
@import java.util.Optional | ||
@param TemplateModel model | ||
@param TemplateData model | ||
<!--/* | ||
Copyright 2023 Cyril de Catheu | ||
|
@@ -646,7 +647,9 @@ | |
background-color: #ffe4e4; | ||
} | ||
[x-cloak] { display: none !important; } | ||
[x-cloak] { | ||
display: none !important; | ||
} | ||
</style> | ||
|
||
<script defer class="jnb-no-opti" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script> | ||
|
@@ -670,7 +673,7 @@ | |
</head> | ||
<body> | ||
<div x-cloak x-data="{ tocOpen: window.innerWidth >= 768, notebookStatus: 'Connected'}" class="flex"> | ||
<button x-on:click="tocOpen = ! tocOpen" | ||
<button x-on:click="tocOpen=!tocOpen" | ||
class="toc-toggle z-20 fixed right-2 top-2 md:right-auto md:left-3 md:top-[7px] text-slate-400 font-sans text-xs hover:underline cursor-pointer flex items-center bg-white py-1 px-3 md:p-0 rounded-full md:rounded-none border md:border-0 border-slate-200 shadow md:shadow-none"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" width="20" | ||
height="20"> | ||
|
@@ -687,7 +690,7 @@ | |
<div class="px-3 mb-1 mt-1 md:mt-0 text-xs md:text-[12px] uppercase tracking-wider text-slate-500 font-medium px-3 mb-1 leading-none"> | ||
ToC | ||
</div> | ||
<div x-on:click="tocOpen = ! tocOpen" | ||
<div x-on:click="tocOpen=!tocOpen" | ||
class="toc-toggle text-slate-500 absolute right-2 top-[11px] cursor-pointer z-10"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" | ||
stroke-width="2" class="w-4 w-4"> | ||
|
@@ -697,23 +700,13 @@ | |
<div id="toc"></div> | ||
</aside> | ||
<div x-bind:class="tocOpen ? 'toc-offset' : ''" class="flex-auto h-screen overflow-y-auto scroll-container"> | ||
@if(model.render() != null) | ||
<div id="notebook" class="flex flex-col items-center viewer-notebook flex-auto"> | ||
<div id="notebook" class="flex flex-col items-center viewer-notebook flex-auto"> | ||
@if(model.render() != null) | ||
$unsafe{model.render()} | ||
</div> | ||
@else | ||
<div id="notebook" class="flex flex-col items-center viewer-notebook flex-auto"> | ||
<div id="helper" class="viewer viewer-result w-full max-w-prose px-8"> | ||
<div class="relative"> | ||
<div class="overflow-y-hidden"> | ||
<p>Welcome to <code>jnotebook</code>. Learn more on <a href="https://jnotebook.catheu.tech">jnotebook.catheu.tech</a>. | ||
</p> | ||
<p>Edit a <code>.jsh</code> file in your <code>${((InteractiveConfiguration) model.config()).notebookPath}</code> folder to | ||
make your notebook appear.</p></div> | ||
</div> | ||
</div> | ||
</div> | ||
@endif | ||
@else | ||
@template.landing(model=model) | ||
@endif | ||
</div> | ||
</div> | ||
@if(model.interactive()) | ||
<script defer> | ||
|
@@ -761,6 +754,12 @@ | |
update(socketEvent.data); | ||
} | ||
}; | ||
// something like this for the message passing | ||
const textAreas = document.querySelectorAll("button.notebook-in-path") | ||
.forEach(e => e.addEventListener('click', ev => { | ||
socket.send("refresh_" + e.textContent) | ||
})); | ||
} | ||
const port = "${Optional.ofNullable(((InteractiveConfiguration) model.config()).port).orElse(5002)}"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@import tech.catheu.jnotebook.Main.InteractiveConfiguration | ||
@param tech.catheu.jnotebook.server.HtmlTemplateEngine.TemplateData model | ||
|
||
<div id="helper" class="viewer viewer-result w-full max-w-prose px-8"> | ||
<div class="relative"> | ||
<div class="overflow-y-hidden"> | ||
<p>Welcome to <code>jnotebook</code>. Learn more on <a href="https://jnotebook.catheu.tech">jnotebook.catheu.tech</a>. | ||
</p> | ||
<p>Edit a <code>.jsh</code> file in your | ||
<code>${((InteractiveConfiguration) model.config()).notebookPath}</code> folder to | ||
launch your notebook, or click on a notebook below.</p> | ||
<div> | ||
<table> | ||
<tr> | ||
<td>Notebooks</td> | ||
</tr> | ||
@if(model.notebooksInPath() == null || model.notebooksInPath().isEmpty()) | ||
<tr> | ||
<td> | ||
<i>There are no notebooks in the <code>${((InteractiveConfiguration) model.config()).notebookPath}</code> folder.</i> | ||
</td> | ||
</tr> | ||
@else | ||
@for(final java.nio.file.Path p: model.notebooksInPath()) | ||
<tr> | ||
<td><button class="notebook-in-path"><a>${p.toString()}</a></button></td> | ||
</tr> | ||
@endfor | ||
@endif | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |