Skip to content

Frontpage and Heatmap CSS tweaks #13443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 20 additions & 37 deletions web_src/js/components/ActivityHeatmap.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div>
<div class="heatmap-container">
<div v-show="isLoading">
<slot name="loading"/>
</div>
<h4 v-if="!isLoading" class="total-contributions">
{{ values.length }} total contributions in the last 12 months
</h4>
<div v-if="!isLoading" class="total-contributions">
{{ values.length }} contributions in the last 12 months
</div>
<calendar-heatmap
v-show="!isLoading"
:locale="locale"
Expand All @@ -26,45 +26,28 @@ export default {
components: {CalendarHeatmap},
data: () => ({
isLoading: true,
colorRange: [],
endDate: null,
colorRange: [
'var(--color-secondary-alpha-70)',
'var(--color-primary-alpha-50)',
'var(--color-primary-alpha-60)',
'var(--color-primary-alpha-70)',
'var(--color-primary-alpha-80)',
'var(--color-primary)',
],
endDate: new Date(),
values: [],
suburl: AppSubUrl,
user: heatmapUser,
locale: {
contributions: 'contributions',
no_contributions: 'No contributions',
},
}),
mounted() {
this.colorRange = [
this.getColor(0),
this.getColor(1),
this.getColor(2),
this.getColor(3),
this.getColor(4),
this.getColor(5)
];
this.endDate = new Date();
this.loadHeatmap(this.user);
},
methods: {
async loadHeatmap(userName) {
const res = await fetch(`${this.suburl}/api/v1/users/${userName}/heatmap`);
const data = await res.json();
this.values = data.map(({contributions, timestamp}) => {
return {date: new Date(timestamp * 1000), count: contributions};
});
this.isLoading = false;
},
getColor(idx) {
const el = document.createElement('div');
el.className = `heatmap-color-${idx}`;
document.body.appendChild(el);
const color = getComputedStyle(el).backgroundColor;
document.body.removeChild(el);
return color;
}
async mounted() {
const res = await fetch(`${AppSubUrl}/api/v1/users/${heatmapUser}/heatmap`);
const data = await res.json();
this.values = data.map(({contributions, timestamp}) => {
return {date: new Date(timestamp * 1000), count: contributions};
});
this.isLoading = false;
},
};
</script>
Expand Down
117 changes: 67 additions & 50 deletions web_src/less/_base.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,33 @@
--color-primary-alpha-70: #4183c4b3;
--color-primary-alpha-80: #4183c4cc;
--color-primary-alpha-90: #4183c4e1;
--color-secondary: rgba(34, 36, 38, .15);
--color-secondary: #dedede;
--color-secondary-dark-1: #cecece;
--color-secondary-dark-2: #bfbfbf;
--color-secondary-dark-3: #a0a0a0;
--color-secondary-dark-4: #909090;
--color-secondary-dark-5: #818181;
--color-secondary-dark-6: #717171;
--color-secondary-dark-7: #626262;
--color-secondary-dark-7: #525252;
--color-secondary-dark-8: #434343;
--color-secondary-dark-8: #333333;
--color-secondary-dark-9: #242424;
--color-secondary-dark-10: #141414;
--color-secondary-dark-11: #040404;
--color-secondary-light-1: #e5e5e5;
--color-secondary-light-2: #ebebeb;
--color-secondary-light-3: #f2f2f2;
--color-secondary-light-4: #f8f8f8;
--color-secondary-alpha-10: #dedede19;
--color-secondary-alpha-20: #dedede33;
--color-secondary-alpha-30: #dedede4b;
--color-secondary-alpha-40: #dedede66;
--color-secondary-alpha-50: #dedede80;
--color-secondary-alpha-60: #dedede99;
--color-secondary-alpha-70: #dededeb3;
--color-secondary-alpha-80: #dededecc;
--color-secondary-alpha-90: #dededee1;
--color-body: #fff;
}

Expand Down Expand Up @@ -192,6 +218,43 @@ a:hover,
color: var(--color-primary-dark-2);
}

.ui.input.focus > input,
.ui.input > input:focus {
border-color: var(--color-primary);
}

.ui.action.input:not([class*="left action"]) > input:focus {
border-right-color: var(--color-primary);
}

.ui.form input:not([type]):focus,
.ui.form textarea:focus,
.ui.form input[type="date"]:focus,
.ui.form input[type="datetime-local"]:focus,
.ui.form input[type="email"]:focus,
.ui.form input[type="file"]:focus,
.ui.form input[type="number"]:focus,
.ui.form input[type="password"]:focus,
.ui.form input[type="search"]:focus,
.ui.form input[type="tel"]:focus,
.ui.form input[type="text"]:focus,
.ui.form input[type="time"]:focus,
.ui.form input[type="url"]:focus,
.ui.selection.dropdown:focus {
border-color: var(--color-primary);
}

.ui.selection.active.dropdown,
.ui.selection.active.dropdown:hover,
.ui.selection.active.dropdown .menu,
.ui.selection.active.dropdown:hover .menu {
border-color: var(--color-primary-light-2);
}

.ui.selection.dropdown .menu {
margin: 0 -1.25px;
}

.dont-break-out {
overflow-wrap: break-word;
word-wrap: break-word;
Expand Down Expand Up @@ -963,59 +1026,13 @@ footer {
margin-bottom: 2px !important;
}

#user-heatmap {
width: 107%; // Fixes newest contributions not showing
text-align: center;

svg:not(:root) {
overflow: inherit;
padding: 0 !important;
}

@media only screen and (max-width: 1200px) {
& {
display: none;
}
}

.total-contributions {
text-align: left;
font-weight: 500;
margin-top: 0;
}
}

.heatmap-color-0 {
background-color: #f4f4f4;
}

.heatmap-color-1 {
background-color: #d8efbf;
}

.heatmap-color-2 {
background-color: #9fdb81;
}

.heatmap-color-3 {
background-color: #66c74b;
}

.heatmap-color-4 {
background-color: #609926;
}

.heatmap-color-5 {
background-color: #025900;
}

.activity-bar-graph {
background-color: #6cc644;
color: #000000;
background-color: var(--color-primary);
color: #fff;
}

.activity-bar-graph-alt {
color: #000000;
color: #fff;
}

.archived-icon {
Expand Down
9 changes: 6 additions & 3 deletions web_src/less/_dashboard.less
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@

&.feeds {
.news {

li {
display: flex;
align-items: baseline;
Expand Down Expand Up @@ -138,6 +137,10 @@
border-radius: 3px;
word-break: break-all;
}

&:last-of-type .divider {
display: none !important;
}
}

.list {
Expand All @@ -160,7 +163,7 @@

li {
&:not(:last-child) {
border-bottom: 1px solid #ebebeb;
border-bottom: 1px solid var(--color-secondary);
}

&.private {
Expand All @@ -172,7 +175,7 @@
display: block;

.svg {
color: #888888;
color: var(--color-secondary-dark-6);

&.rear {
font-size: 15px;
Expand Down
50 changes: 50 additions & 0 deletions web_src/less/features/heatmap.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#user-heatmap {
width: 107%; // Fixes newest contributions not showing
text-align: center;

svg:not(:root) {
overflow: inherit;
padding: 0 !important;
}

@media (max-width: 1200px) {
& {
display: none;
}
}

.total-contributions {
text-align: left;
font-weight: 500;
margin-top: 0;
}
}

.heatmap-container {
position: relative;
}

.heatmap-container .total-contributions {
font-size: 11px;
position: absolute;
bottom: 0;
left: 25px;
}

@media (max-width: 1200px) {
.heatmap-container .total-contributions {
left: 21px;
}
}

@media (max-width: 1000px) {
.heatmap-container .total-contributions {
font-size: 10px;
left: 17px;
bottom: -2px;
}
}

.heatmap-container text {
fill: currentColor !important;
}
1 change: 1 addition & 0 deletions web_src/less/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

@import "./features/gitgraph.less";
@import "./features/animations.less";
@import "./features/heatmap.less";
@import "./markdown/mermaid.less";

@import "_svg";
Expand Down
Loading