Skip to content

Commit

Permalink
Merge pull request #14916 from pateljannat/discussions-better-empty-s…
Browse files Browse the repository at this point in the history
…tate

style: Discussions better empty state
  • Loading branch information
mergify[bot] committed Nov 12, 2021
2 parents 64a1cc4 + 88ddb7d commit 1e33f38
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 77 deletions.
4 changes: 2 additions & 2 deletions frappe/public/icons/timeless/message.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions frappe/templates/discussions/button.html
@@ -1,7 +1,9 @@
{% if frappe.session.user != "Guest" and
(condition is not defined or (condition is defined and condition )) %}
<span class="button is-secondary reply">
<span class="btn btn-md btn-default reply">
{{ _(cta_title) }}
<svg class="icon icon-sm ml-1"><use href="#icon-add" style="stroke: var(--gray-700)"></use></svg>
<!-- Below svg is not a part of the current design. Hence it is commented.
The comment will be removed after all design changes are implemented. -->
<!-- <svg class="icon icon-sm ml-1"><use href="#icon-add" style="stroke: var(--gray-700)"></use></svg> -->
</span>
{% endif %}
2 changes: 1 addition & 1 deletion frappe/templates/discussions/comment_box.html
Expand Up @@ -28,7 +28,7 @@
</div>

<a class="dark-links cancel-comment hide"> {{ _("Cancel") }} </a>
<div class="button is-default submit-discussion pull-right mb-1">
<div class="btn btn-md btn-default submit-discussion pull-right mb-1">
{{ _("Post") }}
</div>
</div>
Expand Down
23 changes: 11 additions & 12 deletions frappe/templates/discussions/discussions_section.html
Expand Up @@ -8,16 +8,16 @@
{% include "frappe/templates/discussions/topic_modal.html" %}

<div class="discussions-header">
<span class="course-home-headings">{{ _(title) }}</span>
<span class="discussion-heading">{{ _(title) }}</span>
{% if topics and not single_thread %}
{% include "frappe/templates/discussions/button.html" %}
{% endif %}
</div>

<div class="common-card-style thread-card {% if topics | length and not single_thread %} discussions-card {% endif %} ">
<div class="card-style thread-card {% if topics | length and not single_thread %} discussions-card {% endif %}
{% if not topics | length %} empty-state {% endif %}">
{% if topics and not single_thread %}


<div class="discussions-sidebar">
{% include "frappe/templates/discussions/search.html" %}

Expand All @@ -38,24 +38,23 @@
{% include "frappe/templates/discussions/reply_section.html" %}

{% else %}
<div class="no-discussions" id="no-discussions">
<div class="font-weight-bold">No {{ title }}</div>
<div class="small mt-3 mb-3">There are no {{ title | lower }} for this {{ doctype | lower }}, why don't you start
one! </div>
<div class="no-discussions">
<img class="icon icon-xl" src="/assets/frappe/icons/timeless/message.svg">
<div class="discussion-heading mt-4 mb-0" style="color: inherit;"> {{ empty_state_title }} </div>
<div class="small mb-6"> {{ empty_state_subtitle }} </div>
{% if frappe.session.user == "Guest" %}
<div class="button is-primary mt-3" id="login-from-discussion"> {{ _("Log In") }} </div>
<div class="btn btn-default btn-md mt-3" id="login-from-discussion"> {{ _("Login") }} </div>
{% elif condition is defined and not condition %}
<a class="button is-primary mt-3" id="login-from-discussion" href="" data-redirect="{{ redirect_to }}">
<div class="btn btn-default btn-md mt-3" id="login-from-discussion" data-redirect="{{ redirect_to }}">
{{ button_name }}
</a>
</div>
{% else %}
{% include "frappe/templates/discussions/button.html" %}
{% endif %}
</div>
{% endif %}
</div>
</div>
{% endif %}
</div>

{% block script %}
<script> {% include "frappe/templates/discussions/discussions.js" %} </script>
Expand Down
8 changes: 4 additions & 4 deletions frappe/templates/discussions/reply_section.html
Expand Up @@ -9,13 +9,13 @@
{% if topic %} id="t{{ topic.name }}" data-topic="{{ topic.name }}" {% endif %}>

{% if not single_thread %}
<div class="button is-default back">
<div class="btn btn-md btn-default ellipsis back">
{{ _("Back") }}
</div>
{% endif %}

{% if topic and topic.title %}
<div class="course-home-headings p-0">{{ topic.title }}</div>
<div class="discussion-heading p-0">{{ topic.title }}</div>
{% endif %}

{% for reply in replies %}
Expand All @@ -30,9 +30,9 @@
<div class="d-flex flex-column align-items-center small">
{{ _("Want to join the discussion?") }}
{% if frappe.session.user == "Guest" %}
<div class="button is-primary mt-3 mb-3" id="login-from-discussion">{{ _("Log In") }}</div>
<div class="btn btn-default btn-md mt-3 mb-3" id="login-from-discussion">{{ _("Login") }}</div>
{% elif not condition %}
<div class="button is-primary mt-3 mb-3" id="login-from-discussion" data-redirect="{{ redirect_to }}">{{ button_name }}
<div class="btn btn-default btn-md mt-3 mb-3" id="login-from-discussion" data-redirect="{{ redirect_to }}">{{ button_name }}
</div>
{% endif %}
</div>
Expand Down
8 changes: 4 additions & 4 deletions frappe/templates/discussions/sidebar.html
Expand Up @@ -3,12 +3,12 @@
<div class="discussion-topic-title">{{ topic.title }}</div>
<div class="sidebar-info">
{% set creator = frappe.get_doc("User", topic.owner) %}
<span class="course-instructor ml-0">
<span class="reply-author ml-0">
{{ creator.full_name }}
</span>
<span class="small">
<span class="mr-2">
<img src="/assets/frappe/icons/timeless/message.svg">
<span class="small d-flex">
<span class="mr-2 d-flex align-items-center">
<img class="mr-1" src="/assets/frappe/icons/timeless/message.svg">
<span class="reply-count">{{ replies | length }}</span>
</span>
<span> {{ frappe.utils.format_date(topic.creation, "dd MMM YYYY") }} </span>
Expand Down
79 changes: 27 additions & 52 deletions frappe/templates/styles/discussion_style.css
Expand Up @@ -37,7 +37,7 @@
}

.no-discussions {
width: 250px;
width: 500px;
margin: 0 auto;
text-align: center;
}
Expand Down Expand Up @@ -103,7 +103,7 @@
}

.discussion-topic-title {
color: var(--text-color);
color: var(--gray-900);
}

.discussion-on-page .topic-title {
Expand Down Expand Up @@ -137,65 +137,24 @@
align-items: center;
}

.course-home-headings {
.discussion-heading {
font-weight: 600;
font-size: 22px;
line-height: 146%;
letter-spacing: -0.0175em;
color: #192734;
color: var(--gray-900);
margin-bottom: 1rem;
padding: 0 1rem;
}

.common-card-style {
.card-style {
display: flex;
background: #FFFFFF;
background: white;
border-radius: 8px;
position: relative;
border: 1px solid #EEF0F2;
box-shadow: 0 0px 4px 2px #19273405;
}

.button {
box-shadow: var(--btn-shadow);
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
width: fit-content;
padding: 8px 12px 8px;
font-size: 12px;
line-height: 135%;
letter-spacing: -0.011em;
border: none;
}

.is-primary {
background: var(--primary-color);
color: #FFFFFF;
}

.is-primary:hover {
text-decoration: none;
color: #FFFFFF;
}

.is-secondary {
background: #FFFFFF;
}

.is-secondary:hover {
text-decoration: none;
color: inherit;
}

.is-default {
background: #F4F5F6;
color: #1F272E;
border: 1px solid var(--gray-200);
}


.discussions-card {
display: grid;
grid-gap: 2rem;
Expand Down Expand Up @@ -233,19 +192,35 @@
}
}

.course-instructor {
.reply-author {
margin: 0px 8px;
font-size: 12px;
line-height: 135%;
color: var(--text-color);
color: var(--gray-900);
}

.card-divider {
border: 1px solid var(--gray-200);
border-top: 1px solid var(--gray-200);
margin-bottom: 1rem;
}

.card-divider-dark {
border: 1px solid var(--gray-300);
border-top: 1px solid var(--gray-300);
margin-bottom: 1rem;
}

.empty-state {
background: var(--gray-200);
border: 1px dashed var(--gray-400);
box-sizing: border-box;
border-radius: 8px;
padding: 2.5rem;
}

.discussions-parent .btn-default {
color: var(--gray-700);
}

.discussions-header .btn {
float: right;
}
3 changes: 3 additions & 0 deletions frappe/website/web_template/discussions/discussions.html
@@ -1,3 +1,6 @@
{% set doctype = "Web Page" %}
{% set empty_state_title = _("No {0}").format(title) %}
{% set empty_state_subtitle = _("There are no {0} for this {1}, why don't you start one!").format(title | lower , doctype | lower) %}

{% include "frappe/templates/discussions/discussions_section.html" %}

0 comments on commit 1e33f38

Please sign in to comment.