Skip to content

Commit

Permalink
fix: cache, animation and menu
Browse files Browse the repository at this point in the history
  • Loading branch information
pateljannat committed Jun 19, 2024
1 parent 5976585 commit 14bd1ce
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 55 deletions.
4 changes: 2 additions & 2 deletions wiki/public/js/render_wiki.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
constructor(opts) {
super();
$("document").ready(() => {
this.set_darkmode_button();
//this.set_darkmode_button();
if (
window.location.pathname != "/revisions" &&
window.location.pathname != "/compare"
Expand All @@ -100,7 +100,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
this.set_nav_buttons();
this.set_toc();
this.set_last_updated_date();
this.scrolltotop();
//this.scrolltotop();
this.set_add_item();
this.add_trash_icon();
this.set_empty_ul();
Expand Down
4 changes: 2 additions & 2 deletions wiki/public/scss/edit_wiki.scss
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ $font-sizes-mobile: (
}

p {
font-size: 14px;
font-size: 15px;
font-weight: 420;
line-height: 21px;
line-height: 155%;
letter-spacing: 0.02em;
text-align: left;
}
Expand Down
26 changes: 14 additions & 12 deletions wiki/public/scss/wiki.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ body.dark {
}

&:last-child {
font-size: 14px;
font-size: 15px;
font-weight: 500;
color: var(--primary);
transition: color 0.25s;
Expand All @@ -159,6 +159,7 @@ body.dark {
.wiki-page-meta {
font-size: $font-size-sm;
display: flex;
align-items: center;
justify-content: space-between;
}

Expand Down Expand Up @@ -195,7 +196,7 @@ body.dark {
gap: 8px;
}
.sidebar-group-title {
font-size: 14px;
font-size: 15px;
font-weight: 450;
line-height: 16px;
letter-spacing: 0.015em;
Expand Down Expand Up @@ -511,7 +512,7 @@ body.dark {
}

.dropdown-item {
font-size: 14px;
font-size: 15px;
outline: unset;
overflow: auto;
margin: 0.5rem 0;
Expand Down Expand Up @@ -692,9 +693,9 @@ body.dark {
}

p {
font-size: 14px;
font-size: 15px;
font-weight: 420;
line-height: 21px;
line-height: 155%;
letter-spacing: 0.02em;
text-align: left;
}
Expand Down Expand Up @@ -733,14 +734,14 @@ body.dark {
}

li {
font-size: 14px;
font-size: 15px;
font-weight: 420;
line-height: 21px;
line-height: 155%;
letter-spacing: 0.02em;
text-align: left;

&::marker {
font-size: 14px;
font-size: 15px;
}
}
}
Expand Down Expand Up @@ -821,7 +822,7 @@ h6:hover .feather-link {
}

.ratings-number {
font-size: 14px;
font-size: 15px;
padding: 8px 0px;
border: none;
color: #000;
Expand All @@ -841,13 +842,14 @@ h6:hover .feather-link {
.wiki-options {
width: 2rem;
height: 2rem;
margin-top: 1rem;
margin-top: 0.5rem;
margin-left: 0.5rem;

svg {
width: 2rem;
}

#wikiOptionsButton::after {
.dropdown-toggle.wiki-options::after {
display: none;
}

Expand Down Expand Up @@ -958,7 +960,7 @@ h6:hover .feather-link {
}

.user-contributions {
margin: 1rem 0 0 auto;
margin: 0 0 0 auto;
color: var(--sidebar-text-color);
font-size: 0.8rem;
}
Expand Down
6 changes: 0 additions & 6 deletions wiki/wiki/doctype/wiki_page/templates/navbar_items.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@
<div class="d-block d-sm-none sm-sidebar">
<!--sidebar-->
</div>
{% if add_dark_mode -%}
<li class="sun-moon-container">
<svg class="feather feather-moon hide" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
<svg class="feather feather-sun hide" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
</li>
{% endif %}
{% include "templates/includes/navbar/navbar_login.html" %}


Expand Down
46 changes: 23 additions & 23 deletions wiki/wiki/doctype/wiki_page/templates/show.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
<div class="from-markdown {% if edit_wiki_page or new_wiki_page %}hide{% endif %}">
<div class="d-flex justify-content-between align-items-center">
<h1 class="wiki-title">{{ title }}</h1>
<div class="dropdown wiki-options">
<div class="dropdown-toggle" type="button" role="button" id="wikiOptionsButton" data-toggle="dropdown"
aria-label="Wiki Option Button" aria-expanded="false">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="feather feather-more-vertical">
<circle cx="12" cy="12" r="1"></circle>
<circle cx="12" cy="5" r="1"></circle>
<circle cx="12" cy="19" r="1"></circle>
</svg>
</div>
<div class="dropdown-menu d-print-none" aria-labelledby="wikiOptionsButton">
<a class="dropdown-item edit-wiki-btn" href="#">Edit Page</a>
<a class="dropdown-item add-wiki-btn" href="#">New Page</a>
<a class="dropdown-item show-revisions" href="#" data-toggle="modal" data-target="#revisionsModal">
Revisions
</a>
<a class="dropdown-item show-page-settings" href="#" data-toggle="modal"
data-target="#pageSettingsModal">
Page Settings
</a>
</div>
</div>
</div>
<div class="wiki-content">
{{ content }}
Expand Down Expand Up @@ -66,6 +43,29 @@ <h5 class="modal-title" id="addGroupModalTitle">Title</h5>
<div class="user-contributions" data-date="{{ last_revision.modified }}">
</div>
{%- endif -%}
<div class="dropdown">
<div class="dropdown-toggle wiki-options" type="button" role="button" id="wikiOptionsButton" data-toggle="dropdown"
aria-label="Wiki Option Button" aria-expanded="false">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="feather feather-more-vertical">
<circle cx="12" cy="12" r="1"></circle>
<circle cx="12" cy="5" r="1"></circle>
<circle cx="12" cy="19" r="1"></circle>
</svg>
</div>
<div class="dropdown-menu d-print-none" aria-labelledby="wikiOptionsButton">
<a class="dropdown-item edit-wiki-btn" href="#">Edit Page</a>
<a class="dropdown-item add-wiki-btn" href="#">New Page</a>
<a class="dropdown-item show-revisions" href="#" data-toggle="modal" data-target="#revisionsModal">
Revisions
</a>
<a class="dropdown-item show-page-settings" href="#" data-toggle="modal"
data-target="#pageSettingsModal">
Page Settings
</a>
</div>
</div>
</div>
<div class="wiki-footer hide d-print-none">
<div class="forward-back">
Expand Down
2 changes: 1 addition & 1 deletion wiki/wiki/doctype/wiki_page/templates/wiki_navbar.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<script>
if (localStorage.getItem("darkMode") === "true" || (!("darkMode" in localStorage) && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches))
if (window.matchMedia?.("(prefers-color-scheme: dark)")?.matches)
document.body.classList.add("dark");
</script>

Expand Down
2 changes: 1 addition & 1 deletion wiki/wiki/doctype/wiki_page/wiki_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ def get_context(self, context):
wiki_space_name = frappe.get_value("Wiki Group Item", {"wiki_page": self.name}, "parent")
wiki_space = frappe.get_doc("Wiki Space", wiki_space_name)

context.no_cache = 1
context.navbar_search = wiki_settings.add_search_bar
context.add_dark_mode = wiki_settings.add_dark_mode
context.light_mode_logo = wiki_space.light_mode_logo or wiki_settings.logo
context.dark_mode_logo = wiki_space.dark_mode_logo or wiki_settings.dark_mode_logo
if wiki_space.light_mode_logo or wiki_space.dark_mode_logo:
Expand Down
9 changes: 1 addition & 8 deletions wiki/wiki/doctype/wiki_settings/wiki_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"general_tab",
"theme_section",
"logo",
"add_dark_mode",
"dark_mode_logo",
"section_break_vefv",
"default_wiki_space",
Expand Down Expand Up @@ -52,12 +51,6 @@
"fieldtype": "Attach Image",
"label": "Dark Mode Logo"
},
{
"default": "0",
"fieldname": "add_dark_mode",
"fieldtype": "Check",
"label": "Add Dark Mode"
},
{
"fieldname": "navbar_tab",
"fieldtype": "Tab Break",
Expand Down Expand Up @@ -161,7 +154,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-06-03 16:19:02.137666",
"modified": "2024-06-03 16:19:02.137667",
"modified_by": "Administrator",
"module": "Wiki",
"name": "Wiki Settings",
Expand Down

1 comment on commit 14bd1ce

@hardik-limendo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @pateljannat, May I know why the dark mode has been removed from the wiki? Is there any new dark mode functionality that is going to be added?

Please sign in to comment.