Skip to content

Commit

Permalink
undo move to file does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
HoloPollock committed Oct 14, 2021
1 parent 842e09a commit 953e3a0
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 73 deletions.
22 changes: 12 additions & 10 deletions src/components/Controls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,27 @@

<script setup lang="ts">
import { ref, watch } from 'vue'
import { ControlsProps } from '../types/props'
import { ControlEmits } from '../types/emits'
const props = withDefaults(defineProps<ControlsProps>(), {
lowestYear: 2011
})
const emit = defineEmits<ControlEmits>()
const urlParams = new URLSearchParams(window.location.search)
const currentYear = new Date().getFullYear()
const selectedYear = ref(currentYear)
const emit = defineEmits<{(event: 'changeUsername', value: string): void, (event: 'changeYear', value: number): void}>()
const urlParams = new URLSearchParams(window.location.search)
const username = ref(urlParams.get("u"))
if (username.value != null) {
emit("changeUsername", username.value)
}
type ControlsProps = {
lowestYear?: number
}
const props = withDefaults(defineProps<ControlsProps>() ,{
lowestYear: 2011
})
const range = (start: number, end: number) => {
if (selectedYear.value < end) {
selectedYear.value = currentYear
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
</p>
</footer>
</template>
<script setup lang="ts"></script>

<style scoped>
footer
Expand Down
107 changes: 61 additions & 46 deletions src/components/Graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 317 41" aria-labelledby="" class="graph">
<template v-if="username != ''">
<a v-for="day in getDaysInTheYear(year)"
<a v-for="day in daysInTheYear(year)"
:key="day"
:href="getLink(year, day)"
target="_blank"
Expand All @@ -17,7 +17,7 @@
</a>
</template>
<template v-else>
<rect v-for="day in getDaysInTheYear(year)"
<rect v-for="day in daysInTheYear(year)"
:key="day"
:transform="'translate('+((getWeekNumber(year, day)) * 6)+' '+(getWeekDay(year, day) * 6)+')'"
:fill="'var(--accent-0)'"
Expand All @@ -38,18 +38,14 @@
<script setup lang="ts">
import { computed } from 'vue'
import { directive } from 'vue-tippy'
import { GraphProps } from '../types/props'
import useDates from '../composables/useDates'
type GraphProps = {
year: number,
films: Record<string, Record<string, number>>,
username: string
}
const props = defineProps<GraphProps>()
const {
getDate,
getWeekDay,
getWeekNumber,
getDaysInTheYear
} = useDates()
// scale increment = 1/5th the maximum watched in any one day
// or if object is undefined, scale increment = 1
const scale = computed(() => {
Expand All @@ -61,9 +57,23 @@
}
})
const getDate = (year: number, day: number) => {
var date = new Date(year, 0)
return new Date(date.setDate(day))
}
const getWeekDay = (year: number, day: number) => {
return getDate(year, day).getDay()
}
const getWeekNumber = (year:number, day:number) => {
let firstDay = (getWeekDay(year, 0) + 1) % 7
return Math.ceil((day + firstDay) / 7) - 1
}
const filmsWatchedOn = (year: number, day: number) => {
const date = getDate(year, day);
const formattedDate = (date.getMonth() + 1) + '/' + date.getDate()
var date = getDate(year, day);
var formattedDate = (date.getMonth() + 1) + '/' + date.getDate()
try {
return +props.films[year][formattedDate] || 0
Expand All @@ -73,7 +83,12 @@
}
}
const getLink = (year: number, day: number) => {
const daysInTheYear = (year: number) => {
var isLeapYear = (new Date(year, 1, 29).getDate() === 29)
return isLeapYear ? 366 : 365
}
const getLink = (year: number, day:number) => {
const date = getDate(year, day);
return `https://letterboxd.com/${props.username}/films/diary/for/${date.getFullYear()}/${(date.getMonth() + 1).toString().padStart(2, '0')}/${(date.getDate()).toString().padStart(2, '0')}/`
}
Expand Down Expand Up @@ -120,45 +135,45 @@
width: var(--space);
pointer-events: none;
background: linear-gradient(to right,
rgba(25, 30, 37, 0.000) 0%,
rgba(25, 30, 37, 0.013) 9.6%,
rgba(25, 30, 37, 0.049) 18.1%,
rgba(25, 30, 37, 0.104) 25.6%,
rgba(25, 30, 37, 0.175) 32.3%,
rgba(25, 30, 37, 0.259) 38.4%,
rgba(25, 30, 37, 0.352) 44.0%,
rgba(25, 30, 37, 0.450) 49.3%,
rgba(25, 30, 37, 0.550) 54.4%,
rgba(25, 30, 37, 0.648) 59.6%,
rgba(25, 30, 37, 0.741) 65.0%,
rgba(25, 30, 37, 0.825) 70.6%,
rgba(25, 30, 37, 0.896) 76.8%,
rgba(25, 30, 37, 0.951) 83.7%,
rgba(25, 30, 37, 0.987) 91.3%,
rgba(25, 30, 37, 1.000) 100%);
rgba(25, 30, 37, 0.000) 0%,
rgba(25, 30, 37, 0.013) 9.6%,
rgba(25, 30, 37, 0.049) 18.1%,
rgba(25, 30, 37, 0.104) 25.6%,
rgba(25, 30, 37, 0.175) 32.3%,
rgba(25, 30, 37, 0.259) 38.4%,
rgba(25, 30, 37, 0.352) 44.0%,
rgba(25, 30, 37, 0.450) 49.3%,
rgba(25, 30, 37, 0.550) 54.4%,
rgba(25, 30, 37, 0.648) 59.6%,
rgba(25, 30, 37, 0.741) 65.0%,
rgba(25, 30, 37, 0.825) 70.6%,
rgba(25, 30, 37, 0.896) 76.8%,
rgba(25, 30, 37, 0.951) 83.7%,
rgba(25, 30, 37, 0.987) 91.3%,
rgba(25, 30, 37, 1.000) 100%);
}
div::before
{
left: 0;
right: unset;
background: linear-gradient(to left,
rgba(25, 30, 37, 0.000) 0%,
rgba(25, 30, 37, 0.013) 9.6%,
rgba(25, 30, 37, 0.049) 18.1%,
rgba(25, 30, 37, 0.104) 25.6%,
rgba(25, 30, 37, 0.175) 32.3%,
rgba(25, 30, 37, 0.259) 38.4%,
rgba(25, 30, 37, 0.352) 44.0%,
rgba(25, 30, 37, 0.450) 49.3%,
rgba(25, 30, 37, 0.550) 54.4%,
rgba(25, 30, 37, 0.648) 59.6%,
rgba(25, 30, 37, 0.741) 65.0%,
rgba(25, 30, 37, 0.825) 70.6%,
rgba(25, 30, 37, 0.896) 76.8%,
rgba(25, 30, 37, 0.951) 83.7%,
rgba(25, 30, 37, 0.987) 91.3%,
rgba(25, 30, 37, 1.000) 100%);
rgba(25, 30, 37, 0.000) 0%,
rgba(25, 30, 37, 0.013) 9.6%,
rgba(25, 30, 37, 0.049) 18.1%,
rgba(25, 30, 37, 0.104) 25.6%,
rgba(25, 30, 37, 0.175) 32.3%,
rgba(25, 30, 37, 0.259) 38.4%,
rgba(25, 30, 37, 0.352) 44.0%,
rgba(25, 30, 37, 0.450) 49.3%,
rgba(25, 30, 37, 0.550) 54.4%,
rgba(25, 30, 37, 0.648) 59.6%,
rgba(25, 30, 37, 0.741) 65.0%,
rgba(25, 30, 37, 0.825) 70.6%,
rgba(25, 30, 37, 0.896) 76.8%,
rgba(25, 30, 37, 0.951) 83.7%,
rgba(25, 30, 37, 0.987) 91.3%,
rgba(25, 30, 37, 1.000) 100%);
}
#scroll-prompt
Expand Down
2 changes: 1 addition & 1 deletion src/components/Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</template>

<script setup lang="ts">
import { StatusProps } from '../types/props'
type StatusProps = { type: string; message: string; }
const props = defineProps<StatusProps>()
</script>

Expand Down
4 changes: 0 additions & 4 deletions src/types/emits.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/types/props.ts

This file was deleted.

0 comments on commit 953e3a0

Please sign in to comment.