mirror of
https://github.com/status-im/open-bounty.git
synced 2025-02-23 06:38:09 +00:00
Activity feed + UI tweaks
* finish missing parts of activity feed feature * render time ago labels with moment.js * css tweaks
This commit is contained in:
parent
2599b85d41
commit
211cc96c90
@ -42,7 +42,8 @@
|
|||||||
[cheshire "5.7.0"]
|
[cheshire "5.7.0"]
|
||||||
[mpg "1.3.0"]
|
[mpg "1.3.0"]
|
||||||
[pandect "0.6.1"]
|
[pandect "0.6.1"]
|
||||||
[prismatic/plumbing "0.5.3"]]
|
[prismatic/plumbing "0.5.3"]
|
||||||
|
[cljsjs/moment "2.17.1-0"]]
|
||||||
|
|
||||||
:min-lein-version "2.0.0"
|
:min-lein-version "2.0.0"
|
||||||
:source-paths ["src/clj" "src/cljc"]
|
:source-paths ["src/clj" "src/cljc"]
|
||||||
|
@ -3,6 +3,7 @@ select
|
|||||||
i.title as issue_title,
|
i.title as issue_title,
|
||||||
i.issue_number,
|
i.issue_number,
|
||||||
r.repo as repo_name,
|
r.repo as repo_name,
|
||||||
|
r.login as repo_owner,
|
||||||
u.name as user_name,
|
u.name as user_name,
|
||||||
u.avatar_url as user_avatar_url,
|
u.avatar_url as user_avatar_url,
|
||||||
i.payout_receipt,
|
i.payout_receipt,
|
||||||
@ -20,6 +21,7 @@ select
|
|||||||
i.title as issue_title,
|
i.title as issue_title,
|
||||||
i.issue_number,
|
i.issue_number,
|
||||||
r.repo as repo_name,
|
r.repo as repo_name,
|
||||||
|
r.login as repo_owner,
|
||||||
u.name as user_name,
|
u.name as user_name,
|
||||||
u.avatar_url as user_avatar_url,
|
u.avatar_url as user_avatar_url,
|
||||||
i.payout_receipt,
|
i.payout_receipt,
|
||||||
@ -38,6 +40,7 @@ create view activity_feed_view as
|
|||||||
select 'open-claim' as type,
|
select 'open-claim' as type,
|
||||||
issue_title,
|
issue_title,
|
||||||
repo_name,
|
repo_name,
|
||||||
|
repo_owner,
|
||||||
issue_number,
|
issue_number,
|
||||||
user_name,
|
user_name,
|
||||||
user_avatar_url,
|
user_avatar_url,
|
||||||
@ -51,6 +54,7 @@ union
|
|||||||
select 'claim-payout' as type,
|
select 'claim-payout' as type,
|
||||||
issue_title,
|
issue_title,
|
||||||
repo_name,
|
repo_name,
|
||||||
|
repo_owner,
|
||||||
issue_number,
|
issue_number,
|
||||||
user_name,
|
user_name,
|
||||||
user_avatar_url,
|
user_avatar_url,
|
||||||
@ -64,6 +68,7 @@ union
|
|||||||
select 'new-bounty' as type,
|
select 'new-bounty' as type,
|
||||||
issue_title,
|
issue_title,
|
||||||
repo_name,
|
repo_name,
|
||||||
|
repo_owner,
|
||||||
issue_number,
|
issue_number,
|
||||||
user_name,
|
user_name,
|
||||||
user_avatar_url,
|
user_avatar_url,
|
||||||
@ -76,6 +81,7 @@ union
|
|||||||
select 'balance-update' as type,
|
select 'balance-update' as type,
|
||||||
issue_title,
|
issue_title,
|
||||||
repo_name,
|
repo_name,
|
||||||
|
repo_owner,
|
||||||
issue_number,
|
issue_number,
|
||||||
user_name,
|
user_name,
|
||||||
user_avatar_url,
|
user_avatar_url,
|
||||||
|
@ -289,6 +289,7 @@ SELECT
|
|||||||
i.confirm_hash AS confirm_hash,
|
i.confirm_hash AS confirm_hash,
|
||||||
i.payout_hash AS payout_hash,
|
i.payout_hash AS payout_hash,
|
||||||
i.payout_receipt AS payout_receipt,
|
i.payout_receipt AS payout_receipt,
|
||||||
|
i.updated AS updated,
|
||||||
r.repo AS repo_name,
|
r.repo AS repo_name,
|
||||||
o.address AS owner_address
|
o.address AS owner_address
|
||||||
FROM issues i, users o, repositories r
|
FROM issues i, users o, repositories r
|
||||||
@ -436,6 +437,7 @@ SELECT
|
|||||||
type,
|
type,
|
||||||
issue_title,
|
issue_title,
|
||||||
repo_name,
|
repo_name,
|
||||||
|
repo_owner,
|
||||||
issue_number,
|
issue_number,
|
||||||
user_name,
|
user_name,
|
||||||
user_avatar_url,
|
user_avatar_url,
|
||||||
|
@ -117,8 +117,18 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn activity-feed []
|
(defn activity-feed []
|
||||||
(let [activity-items (bounties-db/bounty-activity)]
|
(let [renames {:user_name :display-name
|
||||||
(map #(update % :balance decimal->str) activity-items)))
|
:user_avatar_url :avatar-url
|
||||||
|
:issue_title :issue-title
|
||||||
|
:type :item-type
|
||||||
|
:repo_name :repo-name
|
||||||
|
:repo_owner :repo-owner
|
||||||
|
:issue_number :issue-number}
|
||||||
|
activity-items (bounties-db/bounty-activity)]
|
||||||
|
(map #(-> %
|
||||||
|
(rename-keys renames)
|
||||||
|
(update :balance decimal->str))
|
||||||
|
activity-items)))
|
||||||
|
|
||||||
|
|
||||||
(defapi service-routes
|
(defapi service-routes
|
||||||
|
@ -1,25 +1,48 @@
|
|||||||
(ns commiteth.activity
|
(ns commiteth.activity
|
||||||
(:require [re-frame.core :as rf]
|
(:require [re-frame.core :as rf]
|
||||||
[reagent.core :as r]))
|
[reagent.core :as r]
|
||||||
|
[commiteth.common :refer [moment-timestamp
|
||||||
|
issue-url]]))
|
||||||
|
|
||||||
|
|
||||||
|
(defn item-description [{:keys [display-name
|
||||||
|
balance
|
||||||
|
issue-title
|
||||||
|
item-type
|
||||||
|
repo-name
|
||||||
|
issue-number] :as item}]
|
||||||
|
(let [issue-link [:a
|
||||||
|
{:href (issue-url repo-name issue-number)}
|
||||||
|
issue-title]]
|
||||||
|
(println item)
|
||||||
|
(case item-type
|
||||||
|
"new-bounty" [:p "Opened a bounty for " issue-link]
|
||||||
|
"claim-payout" [:p "Received " [:span.balance "ETH " balance]
|
||||||
|
" for " issue-link]
|
||||||
|
"open-claim" [:p "Submitted a claim for " issue-link]
|
||||||
|
"balance-update" [:p issue-link " bounty increased to "
|
||||||
|
[:div.balance balance]]
|
||||||
|
"")))
|
||||||
|
|
||||||
(defn activity-item [{image-url :user_avatar_url
|
|
||||||
display-name :user_name
|
|
||||||
timestamp :updated
|
|
||||||
balance :balance
|
|
||||||
issue-title :issue_title
|
|
||||||
item-type :type} item]
|
|
||||||
|
|
||||||
|
(defn activity-item [{:keys [avatar-url
|
||||||
|
display-name
|
||||||
|
updated
|
||||||
|
balance
|
||||||
|
issue-title
|
||||||
|
item-type] :as item}]
|
||||||
|
(println avatar-url)
|
||||||
[:div.item.activity-item
|
[:div.item.activity-item
|
||||||
[:div.ui.mini.circular.image
|
[:div.ui.mini.circular.image
|
||||||
[:img {:src image-url}]]
|
[:img {:src avatar-url}]]
|
||||||
[:div.content
|
[:div.content
|
||||||
[:div.header display-name]
|
[:div.header.display-name display-name]
|
||||||
[:div.description
|
[:div.description
|
||||||
[:p item-type]
|
[item-description item]]
|
||||||
[:p issue-title]]
|
[:div.footer-row
|
||||||
#_[:div.time timestamp]]])
|
(when (not (= item-type "new-bounty"))
|
||||||
|
[:div.balance-badge (str "ETH " balance )])
|
||||||
|
[:div.time (moment-timestamp updated)]]]])
|
||||||
|
|
||||||
(defn activity-page []
|
(defn activity-page []
|
||||||
(let [activity-items (rf/subscribe [:activity-feed])]
|
(let [activity-items (rf/subscribe [:activity-feed])]
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
(ns commiteth.bounties
|
(ns commiteth.bounties
|
||||||
(:require [re-frame.core :as rf]))
|
(:require [re-frame.core :as rf]
|
||||||
|
[commiteth.common :refer [moment-timestamp]]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +17,8 @@
|
|||||||
issue-title :issue_title} claim
|
issue-title :issue_title} claim
|
||||||
merged? (= 1 (:pr_state claim))
|
merged? (= 1 (:pr_state claim))
|
||||||
paid? (not-empty (:payout_hash claim))
|
paid? (not-empty (:payout_hash claim))
|
||||||
confirming? (:confirming? bounty)]
|
confirming? (:confirming? bounty)
|
||||||
|
updated (:updated bounty)]
|
||||||
(println "paid?" paid? "merged?" merged? (and merged? ((comp not) paid?)))
|
(println "paid?" paid? "merged?" merged? (and merged? ((comp not) paid?)))
|
||||||
[:div.activity-item
|
[:div.activity-item
|
||||||
[:div.ui.grid.container
|
[:div.ui.grid.container
|
||||||
@ -30,7 +32,7 @@
|
|||||||
[:div.description (if paid?
|
[:div.description (if paid?
|
||||||
"(paid)"
|
"(paid)"
|
||||||
(str "(" (if merged? "merged" "open") ")"))]
|
(str "(" (if merged? "merged" "open") ")"))]
|
||||||
[:div.time "1 day ago"] ;; TODO: claim timestamp
|
[:div.time (moment-timestamp updated)]
|
||||||
[:button.ui.button
|
[:button.ui.button
|
||||||
(merge (if (and merged? (not paid?))
|
(merge (if (and merged? (not paid?))
|
||||||
{}
|
{}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
(ns commiteth.common
|
(ns commiteth.common
|
||||||
(:require [reagent.core :as r]
|
(:require [reagent.core :as r]
|
||||||
[re-frame.core :as rf]))
|
[re-frame.core :as rf]
|
||||||
|
[cljsjs.moment]))
|
||||||
|
|
||||||
(defn input [val-ratom props]
|
(defn input [val-ratom props]
|
||||||
(fn []
|
(fn []
|
||||||
@ -20,3 +21,12 @@
|
|||||||
^{:key item} [:option
|
^{:key item} [:option
|
||||||
{:value item}
|
{:value item}
|
||||||
item]))]))
|
item]))]))
|
||||||
|
|
||||||
|
(defn moment-timestamp [time]
|
||||||
|
(let [now (.now js/Date.)
|
||||||
|
js-time (clj->js time)]
|
||||||
|
(-> (js/moment.utc)
|
||||||
|
(.to js-time))))
|
||||||
|
|
||||||
|
(defn issue-url [repo number]
|
||||||
|
(str "https://github.com/" repo "/issues/" number))
|
||||||
|
@ -277,6 +277,34 @@ span.dropdown.icon {
|
|||||||
color: #a8aab1;
|
color: #a8aab1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.activity-item {
|
||||||
|
.display-name,.description {
|
||||||
|
color: #474951!important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-row {
|
||||||
|
padding: 1em 0 0;
|
||||||
|
.balance-badge {
|
||||||
|
float: left;
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-badge {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #61deb0;
|
||||||
|
font-size: 0.9em;
|
||||||
|
width: auto;
|
||||||
|
min-width: 0;
|
||||||
|
height: auto;
|
||||||
|
min-height: 0;
|
||||||
|
line-height: 2em;
|
||||||
|
display: table;
|
||||||
|
padding: 0 .5em 0;
|
||||||
|
letter-spacing: .04em;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.flash-message {
|
.flash-message {
|
||||||
&.success {
|
&.success {
|
||||||
background-color: #61deb0;
|
background-color: #61deb0;
|
||||||
@ -298,7 +326,6 @@ span.dropdown.icon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.ui {
|
.ui {
|
||||||
font-family: 'postgrotesk'!important;
|
font-family: 'postgrotesk'!important;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user