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

fix: random issues resolved with my kiva work #5603

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/components/MyKiva/BorrowerCarousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
tw-rounded-full tw-shadow"
>
<BorrowerImage
class="tw-w-full tw-rounded-full tw-bg-brand"
class="tw-w-full tw-rounded-full"
:alt="getBorrowerName(loan)"
:aspect-ratio="1"
:default-image="{ width: 80, faceZoom: 50 }"
Expand All @@ -49,7 +49,7 @@
]"
/>
</div>
<h5 class="tw-text-center tw-text-ellipsis tw-line-clamp-2 tw-whitespace-normal">
<h5 class="tw-text-center tw-text-ellipsis tw-line-clamp-2 tw-whitespace-normal tw-pt-0.5">
{{ getBorrowerName(loan) }}
</h5>
</div>
Expand Down Expand Up @@ -102,6 +102,7 @@
</template>

<script setup>
import _throttle from 'lodash/throttle';
import KvTabs from '@kiva/kv-components/vue/KvTabs';
import KvTab from '@kiva/kv-components/vue/KvTab';
import KvTabPanel from '@kiva/kv-components/vue/KvTabPanel';
Expand All @@ -115,7 +116,8 @@ import {
computed,
toRefs,
inject,
onMounted
onMounted,
onBeforeUnmount
} from 'vue';
import {
PAYING_BACK,
Expand Down Expand Up @@ -147,6 +149,7 @@ const emit = defineEmits(['selected-loan']);

const { loans } = toRefs(props);
const carousel = ref(null);
const windowWidth = ref(0);

const hasActiveLoans = computed(() => {
return loans.value.some(loan => [FUNDED, FUNDRAISING, PAYING_BACK, RAISED].includes(loan?.status));
Expand Down Expand Up @@ -204,7 +207,7 @@ const filteredLoans = computed(() => {
});

const singleSlideWidth = computed(() => {
const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : 520;
const viewportWidth = typeof window !== 'undefined' ? windowWidth.value : 520;

if (viewportWidth < 768) {
return '288px';
Expand All @@ -218,12 +221,26 @@ const hasCompletedBorrowers = computed(() => {
return loans.value.some(loan => loan?.status === ENDED || loan?.status === DEFAULTED);
});

const handleResize = () => {
windowWidth.value = window.innerWidth;
};

const throttledResize = _throttle(handleResize, 200);

onMounted(() => {
if (!hasActiveLoans.value) {
$kvTrackEvent('portfolio', 'view', 'no-active-borrowers');
} else {
$kvTrackEvent('portfolio', 'view', 'active-borrowers', loans.value.length);
}

window.addEventListener('resize', throttledResize);

handleResize();
});

onBeforeUnmount(() => {
window.removeEventListener('resize', throttledResize);
});

</script>
Expand Down
14 changes: 11 additions & 3 deletions src/components/MyKiva/BorrowerStatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
tw-rounded-full tw-shadow tw--mt-5"
>
<BorrowerImage
class="tw-w-full tw-rounded-full tw-bg-brand"
class="tw-w-full tw-rounded-full"
:alt="borrowerName"
:aspect-ratio="1"
:default-image="{ width: 80, faceZoom: 50 }"
Expand All @@ -29,8 +29,9 @@
</h3>
<p class="tw-text-center md:tw-text-left">
{{ description }}
<br>
<a
class="tw-w-full md:tw-w-auto tw-text-action"
class="tw-text-action"
:href="`/lend/${loan.id}`"
variant="primary"
v-kv-track-event="['portfolio', 'click', 'view-details', borrowerName, loan.id]"
Expand All @@ -54,7 +55,7 @@
:icon="open ? mdiChevronUp : mdiChevronDown"
/>
</button>
<kv-expandable easing="ease-in-out">
<kv-expandable easing="ease-in-out" class="tw-block md:tw-hidden">
<div v-show="open">
<LoanNextSteps
class="tw-mb-5"
Expand All @@ -65,6 +66,13 @@
/>
</div>
</kv-expandable>
<LoanNextSteps
class="tw-hidden md:tw-block tw-mb-5"
:weeks-to-repay="weeksToRepay"
:current-step="currentStep"
:repayments-started="!isFundraising"
no-animation
/>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/MyKiva/MyKivaHero.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="tw-w-full landscape tw-relative">
<MyKivaContainer>
<div class="tw-bg-white tw-rounded-b tw-absolute tw-top-0 tw-px-1 tw-py-2">
<div class="tw-bg-white tw-rounded-b tw-absolute tw-top-0 tw-px-1.5 tw-py-2">
<h3>Welcome back 👋</h3>
<div
v-if="isBorrower || isTrustee"
Expand Down Expand Up @@ -37,7 +37,7 @@
@click="$emit('show-navigation')"
>
<kv-material-icon
class="tw-absolute tw-right-0 tw-bg-white tw-p-1 tw-rounded-full tw-mt-2"
class="tw-absolute tw-right-0 tw-bg-white tw-p-0.5 tw-rounded-full tw-mt-2 tw-shadow-lg"
name="settings"
:icon="mdiCogOutline"
/>
Expand Down
28 changes: 16 additions & 12 deletions src/components/MyKiva/MyKivaNavigation.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
<template>
<div
v-if="visible"
class="tw-absolute tw-inset-0 tw-bg-black tw-transition-all tw-duration-150 tw-z-modal
tw-mt-8 md:tw-mt-9 tw-pt-0.5"
:class="{
'tw-bg-opacity-0 tw-delay-300': !open,
'tw-bg-opacity-low': open,
}"
@click.self="closeSideSheet"
class="tw-absolute tw-inset-0 tw-z-modal tw-mt-8 md:tw-mt-9 tw-pt-0.5 tw-overflow-hidden"
>
<div
class="tw-absolute tw-right-0 tw-transition-all tw-duration-300 tw-bg-white tw-rounded-l-lg"
class="tw-absolute tw-inset-0 tw-bg-black tw-transition-all tw-duration-150"
:class="{
'tw-w-0 tw-p-0 tw-delay-200': !open,
'is-open tw-p-3': open,
'tw-bg-opacity-0 tw-delay-300': !open,
'tw-bg-opacity-low': open,
}"
@click.self="closeSideSheet"
></div>
<div
class="my-kiva-navigation tw-absolute tw-right-0 tw-transition-all tw-duration-300 tw-bg-white
tw-rounded-l-lg tw-p-3"
:class="{
'tw-translate-x-full tw-delay-200': !open,
'tw-translate-x-0 tw-p-3': open,
}"
>
<div
Expand Down Expand Up @@ -54,7 +57,7 @@
hover:tw-translate-x-1 hover:lg:tw-translate-x-2 tw-duration-300 tw-delay-100"
>
<router-link
class="tw-text-primary tw-font-medium"
class="tw-text-primary tw-font-medium tw-block"
:to="setting.link"
v-kv-track-event="[
'SecondaryNav links',
Expand Down Expand Up @@ -198,8 +201,9 @@ watch(visible, () => {
</script>

<style lang="postcss" scoped>
.is-open {
.my-kiva-navigation {
width: 20rem;

@screen md {
width: 25rem;
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/MyKiva/MyKivaProfile.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<MyKivaContainer>
<div class="profile tw-flex tw-items-end tw-justify-end tw-gap-3">
<div class="profile tw-flex tw-items-end tw-justify-end tw-gap-4">
<KvLoadingPlaceholder
v-if="isLoading"
class="!tw-h-5 tw-mt-6 md:tw-mt-0"
class="!tw-h-5 tw-mt-6 md:tw-mt-0 tw-mr-auto md:tw-mr-0"
:style="{ width: '10rem' }"
/>
<h2 v-else>
<h2 v-else class="tw-mr-auto md:tw-mr-0">
{{ lenderName }}
</h2>
<a
Expand Down
6 changes: 1 addition & 5 deletions src/components/Thanks/LoanNextSteps.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="steps-container">
<div class="tw-flex tw-flex-col">
<ul class="steps-list tw-flex tw-flex-col tw-justify-end tw-gap-1">
<li
v-for="(step, index) in steps"
Expand Down Expand Up @@ -82,10 +82,6 @@ export default {
</script>

<style lang="postcss" scoped>
.steps-container {
@apply tw-flex tw-flex-col;
}

.steps-list {
@apply tw-list-none tw-p-0 tw-relative;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Portfolio/MyKiva/MyKivaPage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<www-page main-class="tw-bg-secondary">
<www-page main-class="tw-bg-secondary tw-overflow-hidden" class="tw-relative">
<MyKivaNavigation
:visible="showNavigation"
:user-balance="userBalance"
Expand Down
Loading