Skip to content
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

Expanded lunch #168

Closed
wants to merge 14 commits into from
110 changes: 97 additions & 13 deletions src/components/cards/LunchCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,101 @@
No Lunch Data
<what-is-this>Stevenson.Space relies on quality data dispayed by Stevenson's lunch website. We will promptly restore lunch functionality once data is provided there.</what-is-this>
</div>
<div v-else v-for="(items, name) in lunch" :key="name" class="lunch">
<div class="name">{{ name }}</div>
<div v-for="item in items" :key="item" class="item">
{{ item }}
<div v-else>
<div v-if="isMorning" class="breakfast">
<div class="name">Ala Carte Breakfast</div>
<div v-for="item in alBreakfast" :key="item" class="item">
{{ item }}
</div>
</div>
<div v-for="(items, name) in lunch" :key="name" class="lunch">
<div class="name">{{ name }}</div>
<div v-for="item in items" :key="item" class="item">
{{ item }}
</div>
</div>
<div v-for="(items, name) in miscLunch" :key="name" class="exLunch">
<div class="name">{{ name }}</div>
<div v-for="item in items" :key="item" class="item">
{{ item }}
</div>
</div>
</div>
<p>{{ testDate }}</p>
<div class="arrow-container">
<font-awesome-icon
v-show="(expandNums < 3)"
:icon="icons.faChevronDown"
class="expand arrow"
@mousedown="expand"
/>
<font-awesome-icon
v-show="(expandNums > 0)"
:icon="icons.faChevronUp"
class="collapse arrow"
@mousedown="condense"
/>
</div>
</card>
</template>

<script>
import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
import getLunch from '@/utils/lunch';
import Card from '@/components/Card.vue';
import WhatIsThis from '@/components/WhatIsThis.vue';
import { mapState } from 'pinia';
import useScheduleStore from '@/stores/schedules';
import miscData from '@/data/miscLunch.json';
import { dateToSeconds } from '@/utils/util';

export default {
components: { Card, WhatIsThis },
data() {
return {
noLunchData: false,
icons: {
faChevronDown,
faChevronUp,
},
expandNums: 0,
alBreakfast: ['Bacon', 'Sausage', 'Potatoes', 'Eggs'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't they sometimes not have all these items? At least when I went they would rotate the bacon and sausage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now they seem to have all of them

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better name

};
},
computed: {
...mapState(useScheduleStore, ['bell', 'date']),
lunch() {
return getLunch(this.date);
},
testDate() {
return dateToSeconds(this.date);
},
isMorning() {
if (dateToSeconds(this.date) < 30600) { // 30600: Seconds to 8:30 AM
return true;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return currTime < 830

also currTime can be renamed to currentTime

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not resolved, some logic issue here

return false;
},
miscLunch() {
const x = miscData.menuGroups;
let arrangedData = {};
for (let i = 0; i < this.expandNums; i++) {
arrangedData = { ...arrangedData, ...x[i] };
}
return arrangedData;
},
},
methods: {
expand() {
if (this.expandNums < 4) {
this.expandNums += 1;
}
},
condense() {
if (this.expandNums > 0) {
this.expandNums -= 1;
}
},
},
};
</script>
Expand All @@ -49,19 +116,36 @@ export default {
text-align: center
margin-bottom: 4px

.breakfast
border-top: var(--color) 1.5px solid
padding: 10px 0
.lunch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.lunch
.lunch

border-top: var(--color) 1.5px solid
padding: 10px 0

.name
color: var(--color)
font-weight: bold
font-size: .85em
text-align: center
.exLunch
Copy link
Member

@JosephShepin JosephShepin Dec 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better class name

border-top: var(--color) 1.5px solid
padding: 10px 0

.name
color: var(--color)
font-weight: bold
font-size: .85em
text-align: center

.item
text-align: center
margin: auto
margin-top: 5px

.item
text-align: center
margin: auto
margin-top: 5px
.arrow-container
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a newline before .arrow-container

display: flex
justify-content: center

.arrow
margin: -3px 10px 5px 10px
font-size: 1.75em
cursor: pointer
color: var(--color)

</style>
69 changes: 69 additions & 0 deletions src/data/miscLunch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"menuGroups": [
{
"Grill": [
"Hamburger",
"Cheeseburger",
"Chicken Tenders",
"Black Bean Burger",
"Turkey Burger",
"Fries"
],
"Pizza": [
"Cheese",
"Pepperoni",
"Sausage",
"Specialty Pizza",
"Cheese Bread Sticks"
]
},
{
"PWC Jazzmans": [
"Acai Bowls",
"Salads",
"Grains",
"Wraps",
"Sandwitches",
"Fruit Cup",
"Yogurt",
"Antipasto Box",
"Protein Box",
"Bubble Tea"
],
"Coffee and Tea": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that "sides "and "beverages" accompany cafeteria food, while PWC Jazzmans, Grill and Pizza is a separate location. what is "Coffee and Tea"? is that a location of where to get food?

Is there some way we can make it more clear where these items are? I'm thinking some location tag and icon that's like these items are here. Thoughts on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The arrangement ive used is just grouped by order on the school website, but the groups correspond roughly with location. Beverages and Sides are located in the same place as the cafeteria. The grill and pizza is in the wood commons, and the 'Coffee and Tea' category is at Jazzman's. I moved the beverages and sides to the top of the list because it makes more sense in proximity to the rest of the cafeteria foods, but otherwise I think the arrangement makes sense. The locations are common knowledge in my experience, so I'm not sure how useful a location tag would be

"Coffee",
"Latte",
"Mocha",
"Americano",
"Cappuccino",
"Hot Chocolate",
"Hot Tea"
]
},
{
"Sides": [
"Grapes and Cheese",
"Fruit",
"Hummus",
"Veggie Cup",
"Pudding",
"Jell-O",
"Yogurt",
"PB&J",
"Hard Boiled Egg"
],
"Beverages": [
"Assorted Sodas",
"Water",
"Pure Leaf Tea",
"Gatorade",
"Life Water",
"Naked Juice",
"Tropicana Juice",
"Izzi Juice Can",
"Sparkling Water",
"Smoothies"
]
}
]
}