Skip to content

Commit

Permalink
export/html: DIFF: improve preloader, add spinner ; rename preloading…
Browse files Browse the repository at this point in the history
… template
  • Loading branch information
mettta committed Dec 7, 2023
1 parent 3c01c30 commit a0610db
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 60 deletions.
120 changes: 114 additions & 6 deletions strictdoc/export/html/_static/diff.css
Original file line number Diff line number Diff line change
Expand Up @@ -296,25 +296,69 @@ details.diff_document[modified="right"] {
}
.lambda_green {background-color: var(--diff-word-color-right);}

/* preloaded */
/*
The element has been pre-loaded
and a smooth appearance effect is added to it.
The element will retain the computed values set by the last keyframe.
*/
.preloaded {
position: relative;
animation: fadeInPreloaded 1s ease-in-out;
animation-fill-mode: forwards;
}

@keyframes fadeInPreloaded {
from {
opacity: 0;
}
to {
opacity: 1;
}
}

/* skeleton */

.diff_skeleton_spinner_container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
grid-column: 1/3;
grid-row: 2/3;
z-index: 11;
}

.skeleton.diff {
margin-top:40px;
border-color:white"
position: relative;
color: var(--color-fg-accent);
}

.skeleton.diff .diff_2columns {
grid-column: 1 / -1;
height: 32px;
text-align: center;
}

.skeleton.diff .diff_column {
border-color:white
border-color: white;
}

.skeleton.diff .item_ {
width: 200px;
padding:16px; margin:8px; border-radius: 4px;
padding: 16px;
margin: 8px;
border-radius: 4px;
}

.skeleton.diff .item {
padding:16px;
margin:8px;
padding: 16px;
margin: 8px;
border-radius: 4px;
background-color: rgba(255,255,255,1);
/* animation-name: change-color; */
Expand All @@ -335,3 +379,67 @@ details.diff_document[modified="right"] {
opacity: 1;
}
}

.skeleton_spinner {
position: relative;
text-indent: -9999em;
animation: mulShdSpin 1.3s infinite linear;
transform: translateZ(0);
/* size */
font-size: 8px;
margin: 36px;
/* dot */
color: var(--color-fg-accent);
width: 1em;
height: 1em;
border-radius: 50%;
}

@keyframes mulShdSpin {
0%,
100% {
box-shadow: 0 -3em 0 0.2em,
2em -2em 0 0em, 3em 0 0 -1em,
2em 2em 0 -1em, 0 3em 0 -1em,
-2em 2em 0 -1em, -3em 0 0 -1em,
-2em -2em 0 0;
}
12.5% {
box-shadow: 0 -3em 0 0, 2em -2em 0 0.2em,
3em 0 0 0, 2em 2em 0 -1em, 0 3em 0 -1em,
-2em 2em 0 -1em, -3em 0 0 -1em,
-2em -2em 0 -1em;
}
25% {
box-shadow: 0 -3em 0 -0.5em,
2em -2em 0 0, 3em 0 0 0.2em,
2em 2em 0 0, 0 3em 0 -1em,
-2em 2em 0 -1em, -3em 0 0 -1em,
-2em -2em 0 -1em;
}
37.5% {
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em,
3em 0em 0 0, 2em 2em 0 0.2em, 0 3em 0 0em,
-2em 2em 0 -1em, -3em 0em 0 -1em, -2em -2em 0 -1em;
}
50% {
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em,
3em 0 0 -1em, 2em 2em 0 0em, 0 3em 0 0.2em,
-2em 2em 0 0, -3em 0em 0 -1em, -2em -2em 0 -1em;
}
62.5% {
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em,
3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 0,
-2em 2em 0 0.2em, -3em 0 0 0, -2em -2em 0 -1em;
}
75% {
box-shadow: 0em -3em 0 -1em, 2em -2em 0 -1em,
3em 0em 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em,
-2em 2em 0 0, -3em 0em 0 0.2em, -2em -2em 0 0;
}
87.5% {
box-shadow: 0em -3em 0 0, 2em -2em 0 -1em,
3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em,
-2em 2em 0 0, -3em 0em 0 0, -2em -2em 0 0.2em;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<turbo-frame id="diff_result">
{% if results %}
<div class="diff" data-controller="diff">
<div class="diff preloaded" data-controller="diff">
<div class="diff_controls" left>
<a id="diff_left_open" class="action_button"><span>+</span>open all modified</a>
<a id="diff_left_close" class="action_button"><span>–</span>close all</a>
Expand Down
53 changes: 1 addition & 52 deletions strictdoc/export/html/templates/screens/git/main.jinja
Original file line number Diff line number Diff line change
@@ -1,60 +1,9 @@
<div class="main">
{% include "screens/git/form.jinja" %}
{# {% include "screens/git/frame_content.jinja" %} #}

{% if error_message is none and left_revision is not none and right_revision is not none and left_revision|length > 0 and right_revision|length > 0 %}
<turbo-frame id="diff_result" src="/diff_result?left_revision={{ left_revision_urlencoded }}&right_revision={{ right_revision_urlencoded }}">
{# Content will be replaced when /feed has been loaded. #}

<div class="diff skeleton">
<div class="diff_column" left>
<div class="diff_inner" left>
<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
</div>
</div>
<div class="diff_column" right>
<div class="diff_inner" right>
<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
</div>
</div>
</div>

{% include "screens/git/skeleton.jinja" %}
</turbo-frame>
{% endif %}

Expand Down
41 changes: 41 additions & 0 deletions strictdoc/export/html/templates/screens/git/skeleton.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<div class="diff skeleton">
<div class="diff_skeleton_spinner_container">
<div class="skeleton_spinner"></div>
{# <p>It may take a while the first time!</p> #}
</div>
<div class="diff_2columns">{# button panel simulation #}</div>
<div class="diff_column" left>
<div class="diff_inner" left>
<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
</div>
</div>
<div class="diff_column" right>
<div class="diff_inner" right>
<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>

<div class="item_"></div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion strictdoc/server/routers/other_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_git_diff_result(
pass

template = html_templates.jinja_environment().get_template(
"screens/git/frame_content.jinja"
"screens/git/frame_result.jinja"
)

link_renderer = LinkRenderer(
Expand Down

0 comments on commit a0610db

Please sign in to comment.