Skip to content

Commit

Permalink
Merge pull request #80 from innovationacademy-kr/fe/dev/refactor_v4/#75
Browse files Browse the repository at this point in the history
[FE] FIX: home 로딩 시 로딩 애니메이션 보여주기 #75
  • Loading branch information
42inshin authored Dec 29, 2023
2 parents 7211d7f + d1f73a9 commit 7c56336
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/components/common/LoadingAnimation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
height: 6px;
border-radius: 50%;
background-color: var(--gray-soft);
animation: loading 1.2s infinite ease-in;
animation: loading 1.6s infinite ease-in-out;
animation-delay: 0.4s;
}
.loading:before,
Expand All @@ -36,7 +36,7 @@
background-color: var(--gray-soft);
top: 50%;
transform: translateY(-50%);
animation: loading 1.2s infinite linear;
animation: loading 1.6s infinite ease-in-out;
}
.loading:before {
left: -12px;
Expand Down
17 changes: 9 additions & 8 deletions src/components/home/FoldCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ref, watch } from "vue";
import ChevronIcon from "@/components/icons/IconChevron.vue";
import CircleProgress from "@/components/home/CircleProgress.vue";
import LoadingAnimationVue from "@/components/common/LoadingAnimation.vue";
import { useMonthLogStore } from "@/stores/monthlog";
import { useHomeStore } from "@/stores/home";
const props = defineProps<{
Expand All @@ -12,13 +11,15 @@ const props = defineProps<{
isMonth?: boolean;
}>();
const { getGoalDateHour, getGoalMonthHour, setGoalDateHour, setGoalMonthHour } =
useHomeStore();
const monthStore = useMonthLogStore();
const { showIsLoading } = monthStore;
const isLoading = ref(showIsLoading());
const {
getGoalDateHour,
getGoalMonthHour,
setGoalDateHour,
setGoalMonthHour,
getIsLoading,
} = useHomeStore();
const isLoading = ref(getIsLoading());
const isOpen = ref(false);
const goalTimeSet = () => {
if (props.isMonth) {
Expand All @@ -31,7 +32,7 @@ const goalTimeSet = () => {
const goalTime = ref(goalTimeSet());
const colorSet = ref(props.isMonth);
watch(showIsLoading, (val) => {
watch(getIsLoading, (val) => {
isLoading.value = val;
});
Expand Down
9 changes: 4 additions & 5 deletions src/components/home/FoldCardCompact.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ref, watch } from "vue";
import ChevronIcon from "@/components/icons/IconChevron.vue";
import LoadingAnimationVue from "@/components/common/LoadingAnimation.vue";
import { useMonthLogStore } from "@/stores/monthlog";
import { useHomeStore } from "@/stores/home";
const props = defineProps<{
hour: number;
Expand All @@ -11,13 +11,12 @@ const props = defineProps<{
acceptedMin: number;
}>();
const monthStore = useMonthLogStore();
const { showIsLoading } = monthStore;
const isLoading = ref(showIsLoading());
const { getIsLoading } = useHomeStore();
const isLoading = ref(getIsLoading());
const isOpen = ref(false);
watch(showIsLoading, (val) => {
watch(getIsLoading, (val) => {
isLoading.value = val;
});
Expand Down
4 changes: 1 addition & 3 deletions src/stores/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@ export const useHomeStore = defineStore("home", () => {

const apiAccTimes = async () => {
try {
if (!getStorage("weeklyAccTime")) {
isLoading.value = true;
}
isLoading.value = true;
const { data: accTimes } = await getAccTimes();
accDate.value = accTimes.todayAccumulationTime;
accMonth.value = calcSecToTime(accTimes.monthAccumulationTime);
Expand Down
4 changes: 2 additions & 2 deletions src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ watch(getNumberOfPeople, () => {
numberOfPeople.value = getNumberOfPeople();
});
watch(getIsLoading, () => {
isLoading.value = getIsLoading();
watch(getIsLoading, (val) => {
isLoading.value = val;
});
watch(getUserInfo, () => {
Expand Down

0 comments on commit 7c56336

Please sign in to comment.