Skip to content

Commit 19169c6

Browse files
committed
Implemented color-coded categories
1 parent 8bbeddb commit 19169c6

File tree

16 files changed

+424
-543
lines changed

16 files changed

+424
-543
lines changed

api-js/categories/create.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports.create = async (event) => {
4040
name: data.name,
4141
nameLC: data.name.toLowerCase(),
4242
description: data.description,
43+
color: data.color,
4344
createdAt: timestamp,
4445
updatedAt: timestamp,
4546
},

api-js/categories/update.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports.update = async (event) => {
4343
ReturnValues: 'ALL_NEW',
4444
};
4545

46-
const allowedFields = ['name', 'description'];
46+
const allowedFields = ['name', 'description', 'color'];
4747
allowedFields.forEach((field) => {
4848
if (data[field] !== undefined && data[field] !== null) {
4949
params.UpdateExpression += `#${field} = :${field},`;

webapp/assets/coloris.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webapp/components/Card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
background: var(--white);
1313
border-radius: 20px;
1414
}
15-
</style>
15+
</style>

webapp/components/CategoryPill.vue

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<div class="title-card">
3+
<span
4+
class="pill-content"
5+
:style="{
6+
background: color,
7+
color: color && isDark(color) ? 'white' : 'dark',
8+
fontWeight: color && isDark(color) ? '300 !important' : ''
9+
}"
10+
>
11+
<slot></slot>
12+
</span>
13+
</div>
14+
</template>
15+
16+
<script>
17+
export default {
18+
props: {
19+
color: "",
20+
},
21+
methods: {
22+
isDark(hex) {
23+
return (parseInt(hex.slice(1), 16) >> 16) * 0.299 + ((parseInt(hex.slice(1), 16) >> 8) & 0xff) * 0.587 + (parseInt(hex.slice(1), 16) & 0xff) * 0.114 < 186;
24+
},
25+
}
26+
}
27+
</script>
28+
29+
<style scoped>
30+
.pill-content {
31+
padding: 0 7px;
32+
border-radius: 10px;
33+
}
34+
</style>

webapp/components/CategorySelection.vue

Lines changed: 0 additions & 76 deletions
This file was deleted.

webapp/components/Tasks/BacklogTasks.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,6 @@ h2 {
164164
box-shadow: var(--black-transparent) 2.95px 2.95px 3.6px, var(--dark-blue-transparent) 0px 0px 2px 3px;
165165
}
166166
167-
.task-list {
168-
margin-left: 20px;
169-
margin-right: 3px;
170-
}
171-
172167
@media only screen and (max-width: 600px) {
173168
.project-section {
174169
flex-direction: column;
@@ -180,10 +175,6 @@ h2 {
180175
font-weight: 600 !important;
181176
text-transform: uppercase;
182177
}
183-
184-
.task-list {
185-
margin-left: 20px;
186-
}
187178
}
188179
189180
.complete-notice {

webapp/components/Tasks/TaskListItem.vue

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@
2525
</a>
2626
<span class="task-name" v-else>{{ task.name }}</span>
2727
</h4>
28-
<div v-if="prioritiesData[task.project]" class="subTitle">
29-
{{ prioritiesData[task.project].name }}
28+
<div v-if="prioritiesData[task.project]" class="subtitle" >
29+
<category-pill :color="categoriesData[task.category]?.color">
30+
{{ prioritiesData[task.project].name }}
31+
</category-pill>
3032
</div>
31-
<div v-else-if="categoriesData[task.category]" class="subTitle">
32-
{{ categoriesData[task.category].name }}
33+
<div v-else-if="categoriesData[task.category]" class="subtitle">
34+
<category-pill :color="categoriesData[task.category]?.color">
35+
{{ categoriesData[task.category].name }}
36+
</category-pill>
3337
</div>
3438
</div>
3539
</div>
@@ -78,6 +82,7 @@ import { mapState } from 'vuex';
7882
import TaskForm from './TaskForm.vue';
7983
import TaskRightClickMenu from './TaskRightClickMenu.vue';
8084
import Collapsible from '../Collapsible.vue';
85+
import CategoryPill from '../CategoryPill.vue'
8186
8287
export default {
8388
props: {
@@ -96,7 +101,7 @@ export default {
96101
},
97102
},
98103
99-
components: { TaskForm, TaskRightClickMenu, Collapsible },
104+
components: { TaskForm, TaskRightClickMenu, Collapsible, CategoryPill },
100105
101106
data() {
102107
return {
@@ -234,7 +239,7 @@ export default {
234239
min-width: 100px;
235240
}
236241
237-
.subTitle {
242+
.subtitle {
238243
margin-top: 2px;
239244
font-size: 0.8em;
240245
font-weight: 600 !important;

webapp/components/TitleCard.vue

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<div class="title-card">
3+
<h2>{{title}}</h2>
4+
<div class="card-content" :style="{ padding: contentPadding || '20px' }">
5+
<slot></slot>
6+
</div>
7+
</div>
8+
</template>
9+
10+
<script>
11+
export default {
12+
props: {
13+
title: "",
14+
contentPadding: "10px 20px",
15+
},
16+
}
17+
</script>
18+
19+
<style scoped>
20+
h2 {
21+
border-radius: 20px;
22+
border-bottom-left-radius: 0;
23+
border-bottom-right-radius: 0;
24+
margin-bottom: -5px;
25+
}
26+
27+
.card-content {
28+
background: var(--white);
29+
border-bottom-left-radius: 20px;
30+
border-bottom-right-radius: 20px;
31+
margin-bottom: 20px;
32+
box-shadow: var(--black-transparent) 1.95px 1.95px 2.6px, var(--dark-blue-transparenter) 0px 0px 1px 2px;
33+
}
34+
</style>

webapp/nuxt.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ export default {
1818
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Mulish:wght@300&family=Poppins:wght@600&display=swap' },
1919
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Homemade Apple' },
2020
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Cairo' }
21+
],
22+
script :[
23+
{ src: '/coloris.min.js', type: 'text/javascript', body: true }
2124
]
2225
},
2326

2427
// Global CSS: https://go.nuxtjs.dev/config-css
2528
css: [
26-
`~/assets/main.css`
29+
`~/assets/main.css`,
30+
`~/assets/coloris.min.css`
2731
],
2832

2933
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins

0 commit comments

Comments
 (0)