Skip to content

Commit 7b66cb1

Browse files
committed
ui improvments
1 parent e53fec8 commit 7b66cb1

File tree

6 files changed

+116
-11
lines changed

6 files changed

+116
-11
lines changed

src/lib/CollectorBot/handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ def __send_notification(post):
9292
channel_layer.group_send)(
9393
"notifier",
9494
{"type": "send.notification", "id": str(post.id),
95-
"thumnail_photo": post.thumnail_photo, "title": post.title})
95+
"thumnail_photo": post.thumnail_photo, "title": post.title,
96+
"created_at": post.created_at.strftime('%b %d, %Y'),
97+
"author_screen_name": post.author_screen_name,
98+
"rtl": post.rtl})
9699

97100
@classmethod
98101
def __add_post_to_user(cls, post, user_id):

src/static/css/main-light.css

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,57 @@ ul {
686686
margin-top: 0;
687687
}
688688
}
689+
690+
.author__block__rtl {
691+
display: block;
692+
position: relative;
693+
padding-right: 100px;
694+
}
695+
.author__block__rtl .author__avatar {
696+
left: unset;
697+
right: 0;
698+
}
699+
.author__block__rtl .author__name {
700+
text-align: right;
701+
}
702+
.author__block__rtl .author__description {
703+
text-align: right;
704+
}
705+
706+
.author__block {
707+
display: block;
708+
position: relative;
709+
padding-left: 100px;
710+
}
711+
.author__avatar {
712+
position: absolute;
713+
top: 0;
714+
left: 0;
715+
width: 88px;
716+
height: 88px;
717+
border-radius: 50%;
718+
}
719+
720+
.author__name {
721+
display: block;
722+
font-size: 16px;
723+
color: #222831;
724+
line-height: 22px;
725+
letter-spacing: 0.4px;
726+
margin-bottom: 5px;
727+
font-family: "cairo-semibold";
728+
}
729+
730+
.author__description {
731+
word-wrap: break-word;
732+
margin-top: 15px;
733+
margin-bottom: 0;
734+
width: 100%;
735+
font-size: 16px;
736+
line-height: 26px;
737+
color: #222831;
738+
}
739+
689740
.comments {
690741
padding-top: 20px;
691742
margin-top: 50px;

src/static/css/main.css

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,57 @@ ul {
695695
margin-top: 0;
696696
}
697697
}
698+
699+
.author__block__rtl {
700+
display: block;
701+
position: relative;
702+
padding-right: 100px;
703+
}
704+
.author__block__rtl .author__avatar {
705+
left: unset;
706+
right: 0;
707+
}
708+
.author__block__rtl .author__name {
709+
text-align: right;
710+
}
711+
.author__block__rtl .author__description {
712+
text-align: right;
713+
}
714+
715+
.author__block {
716+
display: block;
717+
position: relative;
718+
padding-left: 100px;
719+
}
720+
.author__avatar {
721+
position: absolute;
722+
top: 0;
723+
left: 0;
724+
width: 88px;
725+
height: 88px;
726+
border-radius: 50%;
727+
}
728+
729+
.author__name {
730+
display: block;
731+
font-size: 16px;
732+
color: #fff;
733+
line-height: 22px;
734+
letter-spacing: 0.4px;
735+
margin-bottom: 5px;
736+
font-family: "cairo-semibold";
737+
}
738+
739+
.author__description {
740+
word-wrap: break-word;
741+
margin-top: 15px;
742+
margin-bottom: 0;
743+
width: 100%;
744+
font-size: 16px;
745+
line-height: 26px;
746+
color: #fff;
747+
}
748+
698749
.comments {
699750
padding-top: 20px;
700751
margin-top: 50px;
@@ -714,6 +765,7 @@ ul {
714765
align-items: flex-end;
715766
margin-top: 30px;
716767
}
768+
717769
.comments__autor {
718770
display: block;
719771
position: relative;

src/static/js/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,10 @@ $(document).ready(function () {
146146
return false;
147147
}
148148

149-
document.querySelectorAll(".description-block").forEach((e) => {
149+
document.querySelectorAll(".author__description").forEach((e) => {
150150
if (isUnicode(e.innerText)) {
151151
e.style.direction = "rtl";
152+
document.querySelector(".author__block").classList.add("author__block__rtl");
152153
}
153154
});
154155
});
155-
156-

src/static/js/ws.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ socket.onopen = function open() {
77
socket.onmessage = function recieve(message) {
88
const data = JSON.parse(message.data);
99
const post = data.event;
10-
console.log(post);
1110
$.notifyClose();
1211
$.notify(
1312
{
@@ -38,9 +37,10 @@ socket.onmessage = function recieve(message) {
3837
${post.thumnail_photo}
3938
</div>
4039
<div class="post__meta">
41-
<span>now</span>
40+
<span>${post.created_at}</span>
41+
<span>author : ${post.author_screen_name}</span>
4242
</div>
43-
<h3 class="post__title">${post.title}</h3>
43+
<h3 class="post__title" ${post.rtl ? 'style="direction: rtl; text-align: right;"' : ""}">${post.title}</h3>
4444
<div class="post__wrap">
4545
<a href="/post/${post.id}" class="post__link">Read more</a>
4646
<div class="post__comments">

src/templates/posts/post.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
<div class="container">
3939
<div class="row">
4040
<div class="col-12">
41-
<div class="comments__autor" style="height: unset; padding-right:100px">
42-
<img class="comments__avatar" src="{{post.author_photo}}" alt="" style="width: 88px;height:88px">
43-
<span class="comments__name"><a href="https://twitter.com/{{post.author_screen_name}}"
41+
<div class="author__block">
42+
<img class="author__avatar" src="{{post.author_photo}}" alt="">
43+
<span class="author__name"><a href="https://twitter.com/{{post.author_screen_name}}"
4444
target="_blank">{{post.author_name}}</a></span>
45-
<p class="comments__text description-block">{{post.author_describtion}}</p></span></span>
45+
<p class="author__description">{{post.author_describtion}}</p></span></span>
4646
</div>
4747
</div>
4848
<div class="col-12" style="margin-top: 50px;">

0 commit comments

Comments
 (0)