|
10 | 10 | -- work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
11 | 11 | -->
|
12 | 12 | <title>mikupad</title>
|
| 13 | +<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0"> |
13 | 14 | <script type="importmap">
|
14 | 15 | {
|
15 | 16 | "imports": {
|
|
1035 | 1036 | transform: translate(-50%, -50%);
|
1036 | 1037 | }
|
1037 | 1038 |
|
| 1039 | +#button-settings { |
| 1040 | + display: none; |
| 1041 | +} |
| 1042 | + |
| 1043 | +@media (max-width: 767.98px) { |
| 1044 | + body { |
| 1045 | + flex-direction: column; |
| 1046 | + } |
| 1047 | + #prompt-container { |
| 1048 | + width: 100%; |
| 1049 | + max-width: 100%; |
| 1050 | + border: none !important; /* put this here because for some reason, something adds "border-right: 2px dotted transparent;border-left: 2px dotted transparent;" to prompt-container whenever this element is clicked*/ |
| 1051 | + } |
| 1052 | + #sidebar, html.monospace-dark #sidebar, html.nockoffAI #sidebar { |
| 1053 | + width: auto; |
| 1054 | + max-height: calc(93vh - 8px); |
| 1055 | + position: fixed; |
| 1056 | + left: 0; |
| 1057 | + right: 0; |
| 1058 | + bottom: 0; |
| 1059 | + } |
| 1060 | + #sidebar .SelectBox:first-child, .horz-separator, .collapsible-group { |
| 1061 | + display: none; |
| 1062 | + } |
| 1063 | + #button-settings { |
| 1064 | + display: block; |
| 1065 | + } |
| 1066 | +} |
| 1067 | + |
| 1068 | +@media (min-width: 767.98px) { |
| 1069 | + #sidebar .SelectBox:first-child, .horz-separator, .collapsible-group { |
| 1070 | + display: block !important; |
| 1071 | + } |
| 1072 | +} |
| 1073 | + |
1038 | 1074 | </style>
|
1039 | 1075 | <script type="module">
|
1040 | 1076 |
|
|
4480 | 4516 | showProbs && promptChunks[currentPromptChunk?.index]?.completion_probabilities?.[0]?.probs,
|
4481 | 4517 | [promptChunks, currentPromptChunk, showProbs]);
|
4482 | 4518 |
|
| 4519 | + const sidebar = useRef(null); |
| 4520 | + const [sidebarHeight, setSidebarHeight] = useState(0); |
| 4521 | + const [isMobile, setIsMobile] = useState(false); |
| 4522 | + useEffect(() => { |
| 4523 | + setSidebarHeight(sidebar.current.scrollHeight); |
| 4524 | + const observer = new SVResizeObserver(() => { |
| 4525 | + setIsMobile(window.innerWidth < 767.8); |
| 4526 | + setSidebarHeight(sidebar.current.scrollHeight); |
| 4527 | + }); |
| 4528 | + observer.observe(sidebar.current); |
| 4529 | + return () => observer.disconnect(); |
| 4530 | + }, []); |
| 4531 | + |
4483 | 4532 | return html`
|
4484 |
| - <div id="prompt-container" onMouseMove=${onPromptMouseMove}> |
| 4533 | + <div id="prompt-container" onMouseMove=${onPromptMouseMove} style=${{ 'margin-bottom': isMobile ? sidebarHeight + 'px' : 0 }}> |
4485 | 4534 | <button
|
4486 | 4535 | className="textAreaSettings"
|
4487 | 4536 | onClick=${() => toggleModal("prompt")}>
|
|
4522 | 4571 | <div className="prob">${(prob.prob * 100).toFixed(2)}%</div>
|
4523 | 4572 | </button>`)}
|
4524 | 4573 | </div>` : null}
|
4525 |
| - <div id="sidebar"> |
| 4574 | + <div id="sidebar" ref=${sidebar} style=${{ 'max-height': ''}}> |
4526 | 4575 | <${SelectBox}
|
4527 | 4576 | label="Theme"
|
4528 | 4577 | value=${theme}
|
|
4802 | 4851 | <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path d="M6.974 22.957c-10.957-11.421 2.326-20.865 10.384-13.309l-2.464 2.352h9.106v-8.947l-2.232 2.229c-14.794-13.203-31.51 7.051-14.794 17.675z" fill="var(--color-light)"/></svg>
|
4803 | 4852 | </button>
|
4804 | 4853 | </div>
|
| 4854 | + <button |
| 4855 | + id="button-settings" |
| 4856 | + onClick=${() => { |
| 4857 | + toggleModal("settings"); |
| 4858 | + document.getElementsByClassName("SelectBox")[0].style.display = modalState.settings ? "none" : "block"; |
| 4859 | + document.getElementsByClassName("horz-separator")[0].style.display = modalState.settings ? "none" : "block"; |
| 4860 | + for (const collapseGroup of document.getElementsByClassName("collapsible-group")) |
| 4861 | + collapseGroup.style.display = modalState.settings ? "none" : "block"; |
| 4862 | + }}> |
| 4863 | + <svg transform="translate(0, 2)" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512"><path d="M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z" fill="var(--color-light)"/></svg> |
| 4864 | + </button> |
4805 | 4865 | </div>
|
4806 | 4866 | ${!!lastError && html`
|
4807 | 4867 | <span className="error-text">${lastError}</span>`}
|
|
0 commit comments