Skip to content

Commit

Permalink
6日以上経過、5日経過、4日経過に変更した
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamu-kazu222 committed May 1, 2024
1 parent 2b8aa7e commit f07252b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
14 changes: 7 additions & 7 deletions app/javascript/components/ElapsedDays.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@ export default function ElapsedDays({ countProductsGroupedBy }) {
<ol className="page-nav__items elapsed-days">
<li
className={`page-nav__item is-reply-deadline border-b-0 ${activeClass(
countProductsGroupedBy(7)
countProductsGroupedBy(6)
)}`}>
<a className="page-nav__item-link" href="#6days-elapsed">
<span className="page-nav__item-link-inner">
7日以上経過{` (${countProductsGroupedBy(7)})`}
6日以上経過{` (${countProductsGroupedBy(6)})`}
</span>
</a>
</li>
<li
className={`page-nav__item is-reply-alert border-b-0 ${activeClass(
countProductsGroupedBy(6)
countProductsGroupedBy(5)
)}`}>
<a className="page-nav__item-link" href="#5days-elapsed">
<span className="page-nav__item-link-inner">
6日経過{` (${countProductsGroupedBy(6)})`}
5日経過{` (${countProductsGroupedBy(5)})`}
</span>
</a>
</li>
<li
className={`page-nav__item is-reply-warning border-b-0 ${activeClass(
countProductsGroupedBy(5)
countProductsGroupedBy(4)
)}`}>
<a className="page-nav__item-link" href="#4days-elapsed">
<span className="page-nav__item-link-inner">
5日経過{` (${countProductsGroupedBy(5)})`}
4日経過{` (${countProductsGroupedBy(4)})`}
</span>
</a>
</li>
{[4, 3, 2, 1].map((passedDay) => {
{[3, 2, 1].map((passedDay) => {
return (
<li
key={passedDay}
Expand Down
16 changes: 8 additions & 8 deletions app/javascript/components/Products.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ export default function Products({
return element === undefined ? 0 : element.products.length
}

const isNotProduct5daysElapsed = () => {
const isNotProduct4daysElapsed = () => {
const elapsedDays = []
data.productsGroupedByElapsedDays.forEach((group) => {
elapsedDays.push(group.elapsed_days)
})
return elapsedDays.every((day) => day < 5)
return elapsedDays.every((day) => day < 4)
}
const elapsedDaysId = (elapsedDays) => {
return `${elapsedDays}days-elapsed`
Expand Down Expand Up @@ -97,13 +97,13 @@ export default function Products({
</div>
</>
)
} else if (isDashboard() && isNotProduct5daysElapsed()) {
} else if (isDashboard() && isNotProduct4daysElapsed()) {
return (
<div className="o-empty-message loaded">
<div className="o-empty-message__icon">
<i className="fa-regular fa-smile" />
</div>
<p className="o-empty-message__text">5日経過した提出物はありません</p>
<p className="o-empty-message__text">4日経過した提出物はありません</p>
</div>
)
} else if (selectedTab !== 'unassigned') {
Expand Down Expand Up @@ -210,18 +210,18 @@ function ProductHeader({
countProductsGroupedBy
}) {
let headerClass = 'card-header a-elapsed-days'
if (productsNDaysPassed.elapsed_days === 5) {
if (productsNDaysPassed.elapsed_days === 4) {
headerClass += ' is-reply-warning'
} else if (productsNDaysPassed.elapsed_days === 6) {
} else if (productsNDaysPassed.elapsed_days === 5) {
headerClass += ' is-reply-alert'
} else if (productsNDaysPassed.elapsed_days >= 7) {
} else if (productsNDaysPassed.elapsed_days >= 6) {
headerClass += ' is-reply-deadline'
}

const headerLabel = () => {
if (productsNDaysPassed.elapsed_days === 0) {
return '今日提出'
} else if (productsNDaysPassed.elapsed_days === 7) {
} else if (productsNDaysPassed.elapsed_days === 6) {
return `${productsNDaysPassed.elapsed_days}日以上経過`
} else {
return `${productsNDaysPassed.elapsed_days}日経過`
Expand Down
20 changes: 10 additions & 10 deletions app/javascript/elapsed_days.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ nav.page-body__column.is-sub
.page-nav.a-card
ol.page-nav__items.elapsed-days
li.page-nav__item.is-reply-deadline(
:class='activeClass(countProductsByElapsedDays(7))')
:class='activeClass(countProductsByElapsedDays(6))')
a.page-nav__item-link(href='#6days-elapsed')
span.page-nav__item-link-inner
| 7日以上経過
| ({{ countProductsByElapsedDays(7) }})
| 6日以上経過
| ({{ countProductsByElapsedDays(6) }})
li.page-nav__item.is-reply-alert(
:class='activeClass(countProductsByElapsedDays(6))')
:class='activeClass(countProductsByElapsedDays(5))')
a.page-nav__item-link(href='#5days-elapsed')
span.page-nav__item-link-inner
| 6日経過
| ({{ countProductsByElapsedDays(6) }})
| 5日経過
| ({{ countProductsByElapsedDays(5) }})
li.page-nav__item.is-reply-warning(
:class='activeClass(countProductsByElapsedDays(5))')
:class='activeClass(countProductsByElapsedDays(4))')
a.page-nav__item-link(href='#4days-elapsed')
span.page-nav__item-link-inner
| 5日経過
| ({{ countProductsByElapsedDays(5) }})
| 4日経過
| ({{ countProductsByElapsedDays(4) }})
li.page-nav__item(
v-for='passedDay in [4, 3, 2, 1]',
v-for='passedDay in [3, 2, 1]',
:class='activeClass(countProductsByElapsedDays(passedDay))')
a.page-nav__item-link(:href='"#" + passedDay + "days-elapsed"')
span.page-nav__item-link-inner
Expand Down
8 changes: 4 additions & 4 deletions app/javascript/products.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
.page-body__column.is-main
template(v-for='product_n_days_passed in productsGroupedByElapsedDays') <!-- product_n_days_passedはn日経過の提出物 -->
.a-card(
v-if='!isDashboard || (isDashboard && product_n_days_passed.elapsed_days >= 4 && product_n_days_passed.elapsed_days <= 6)')
v-if='!isDashboard || (isDashboard && product_n_days_passed.elapsed_days >= selectedDays && product_n_days_passed.elapsed_days <= selectedDays + 2)')
//- TODO 以下を共通化する
//- prettier-ignore: need space between v-if and id
header.card-header.a-elapsed-days(
Expand All @@ -40,23 +40,23 @@
v-else-if='product_n_days_passed.elapsed_days === 4', id='4days-elapsed'
)
h2.card-header__title
| {{ product_n_days_passed.elapsed_days }}日経過
| {{ selectedDays }}日経過
span.card-header__count(v-if='selectedTab === "unassigned"')
| ({{ countProductsGroupedBy(product_n_days_passed) }})
//- prettier-ignore: need space between v-else-if and id
header.card-header.a-elapsed-days.is-reply-alert(
v-else-if='product_n_days_passed.elapsed_days === 5', id='5days-elapsed'
)
h2.card-header__title
| {{ product_n_days_passed.elapsed_days }}日経過
| {{ selectedDays + 1 }}日経過
span.card-header__count(v-if='selectedTab === "unassigned"')
| ({{ countProductsGroupedBy(product_n_days_passed) }})
//- prettier-ignore: need space between v-else-if and id
header.card-header.a-elapsed-days.is-reply-deadline(
v-else-if='product_n_days_passed.elapsed_days === 6', id='6days-elapsed'
)
h2.card-header__title
| {{ product_n_days_passed.elapsed_days }}日以上経過
| {{ selectedDays + 2 }}日以上経過
span.card-header__count(v-if='selectedTab === "unassigned"')
| ({{ countProductsGroupedBy(product_n_days_passed) }})
header.card-header.a-elapsed-days(
Expand Down

0 comments on commit f07252b

Please sign in to comment.