Skip to content

Commit 3924acc

Browse files
authored
Layout bug fixes (#127)
Signed-off-by: Gašper Grom <[email protected]>
1 parent f0c34a5 commit 3924acc

File tree

15 files changed

+121
-61
lines changed

15 files changed

+121
-61
lines changed

frontend/app/components/modules/collection/views/collection-details.vue

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@
4848
/>
4949
</div>
5050
</div>
51+
<div
52+
v-if="projects.length < (data?.total || 0)"
53+
class="py-5 lg:py-10 flex justify-center"
54+
>
55+
<lfx-button
56+
size="large"
57+
class="!rounded-full"
58+
@click="loadMore"
59+
>
60+
Load more
61+
</lfx-button>
62+
</div>
5163
</template>
5264

5365
<script setup lang="ts">
@@ -59,9 +71,9 @@ import LfxCollectionHeader from "~/components/modules/collection/components/deta
5971
import LfxCollectionFilters from "~/components/modules/collection/components/details/filters.vue";
6072
import LfxProjectListItem from "~/components/modules/project/components/list/project-list-item.vue";
6173
import LfxProjectListItemLoading from "~/components/modules/project/components/list/project-list-item-loading.vue";
62-
import useScroll from "~/components/shared/utils/scroll";
6374
import LfxIcon from "~/components/uikit/icon/icon.vue";
6475
import LfxMaintainHeight from "~/components/uikit/maintain-height/maintain-height.vue";
76+
import LfxButton from "~/components/uikit/button/button.vue";
6577
6678
const props = defineProps<{
6779
collection: Collection
@@ -70,13 +82,11 @@ const props = defineProps<{
7082
const route = useRoute();
7183
const collectionSlug = route.params.slug as string;
7284
73-
const {scrollTopPercentage} = useScroll();
74-
7585
const sort = ref('contributorCount_desc');
7686
const tab = ref('all');
7787
7888
const page = ref(0);
79-
const pageSize = ref(50);
89+
const pageSize = 60;
8090
8191
const projects = ref([]);
8292
@@ -109,11 +119,9 @@ const { data, status } = await useFetch<Pagination<Project>>(
109119
}
110120
);
111121
112-
watch(scrollTopPercentage, () => {
113-
if (scrollTopPercentage.value >= 100 && projects.value.length < data.value.total) {
114-
page.value += 1;
115-
}
116-
});
122+
const loadMore = () => {
123+
page.value += 1;
124+
};
117125
118126
onMounted(() => {
119127
projects.value = data.value?.data || [];

frontend/app/components/modules/collection/views/collection-list.vue

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@
8686
</div>
8787
</div>
8888
</section>
89+
<div
90+
v-if="collections.length < (data?.total || 0)"
91+
class="py-5 lg:py-10 flex justify-center"
92+
>
93+
<lfx-button
94+
size="large"
95+
class="!rounded-full"
96+
@click="loadMore"
97+
>
98+
Load more
99+
</lfx-button>
100+
</div>
89101
</template>
90102

91103
<script setup lang="ts">
@@ -104,20 +116,19 @@ import useScroll from "~/components/shared/utils/scroll";
104116
import LfxCollectionListItemLoading
105117
from "~/components/modules/collection/components/list/collection-list-item-loading.vue";
106118
import LfxMaintainHeight from "~/components/uikit/maintain-height/maintain-height.vue";
119+
import LfxButton from "~/components/uikit/button/button.vue";
107120
108121
const { showToast } = useToastService();
109122
const {pageWidth} = useResponsive();
110123
const {scrollTop} = useScroll();
111124
112125
const page = ref(0);
113-
const pageSize = ref(10);
126+
const pageSize = 50;
114127
const sort = ref('projectCount_desc');
115128
116129
// const stack = ref('');
117130
// const industry = ref('');
118131
119-
const {scrollTopPercentage} = useScroll();
120-
121132
const collections = ref([]);
122133
123134
watch([sort], () => {
@@ -147,11 +158,9 @@ const { data, status, error } = await useFetch<Pagination<Collection>>(
147158
}
148159
);
149160
150-
watch(scrollTopPercentage, () => {
151-
if (scrollTopPercentage.value >= 100 && collections.value.length < (data.value?.total || 0)) {
152-
page.value += 1;
153-
}
154-
});
161+
const loadMore = () => {
162+
page.value += 1;
163+
};
155164
156165
watch(error, (err) => {
157166
if (err) {

frontend/app/components/modules/project/components/shared/header.vue

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
/>
2626
<h1
2727
class="font-bold mr-3 ease-linear transition-all font-secondary duration-200 text-heading-4"
28-
:class="scrollTop > 50 ? 'md:text-heading-3' : 'md:text-heading-2'"
28+
:class="[
29+
scrollTop > 50 ? 'md:text-heading-3' : 'md:text-heading-2',
30+
repoName ? 'w-[25ch] truncate' : ''
31+
]"
2932
>
3033
{{ props.project.name }}
3134
</h1>
@@ -45,11 +48,11 @@
4548
>
4649
<span
4750
v-if="repoName"
48-
class="font-secondary"
51+
class="font-secondary block text-neutral-900 max-w-[25ch] truncate"
4952
>{{ repoName }}</span>
5053
<span
5154
v-else
52-
class="font-secondary"
55+
class="font-secondary text-neutral-500"
5356
>All repositories</span>
5457
</p>
5558
<lfx-icon
@@ -136,15 +139,16 @@
136139
<lfx-project-repository-switch
137140
v-if="isSearchRepoModalOpen && props.project"
138141
v-model="isSearchRepoModalOpen"
139-
:repo="repoName"
142+
:repo="repoSlug"
140143
:project="props.project"
141144
/>
142145
</template>
143146

144147
<script lang="ts" setup>
145148
import {useRoute} from 'nuxt/app';
146149
import {computed} from 'vue';
147-
import type {Project} from "~~/types/project";
150+
import {storeToRefs} from "pinia";
151+
import type {Project, ProjectRepository} from "~~/types/project";
148152
import {LfxRoutes} from '~/components/shared/types/routes';
149153
import LfxIcon from '~/components/uikit/icon/icon.vue';
150154
import LfxMenuButton from '~/components/uikit/menu-button/menu-button.vue';
@@ -159,14 +163,21 @@ import LfxProjectDateRangePicker from "~/components/modules/project/components/s
159163
import LfxMaintainHeight from "~/components/uikit/maintain-height/maintain-height.vue";
160164
import useResponsive from "~/components/shared/utils/responsive";
161165
import LfxTooltip from "~/components/uikit/tooltip/tooltip.vue";
166+
import {useProjectStore} from "~/components/modules/project/store/project.store";
162167
163168
const props = defineProps<{
164169
project: Project
165170
}>();
166171
167172
const route = useRoute();
168173
169-
const repoName = computed<string>(() => route.params.name as string);
174+
const {projectRepos} = storeToRefs(useProjectStore())
175+
176+
const repo = computed<ProjectRepository | undefined>(
177+
() => projectRepos.value.find((repo) => repo.slug === route.params.name)
178+
);
179+
const repoName = computed<string>(() => (repo.value?.name || '').split('/').at(-1) || '');
180+
const repoSlug = computed<string>(() => route.params.name as string);
170181
171182
const isSearchRepoModalOpen = ref(false);
172183

frontend/app/components/modules/project/components/shared/header/repository-switch.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
<div class="flex flex-col gap-1 max-h-[29.5rem] overflow-y-auto">
4242
<nuxt-link
4343
v-for="repository of result"
44-
:key="repository.repo"
45-
:to="{ name: routeName.repo, params: {name: repository.name}}"
44+
:key="repository.url"
45+
:to="{ name: routeName.repo, params: {name: repository.slug}}"
4646
>
4747
<lfx-project-repository-switch-item
4848
:text="repository.name"
4949
icon="books"
50-
:selected="props.repo === repository.name"
50+
:selected="props.repo === repository.slug"
5151
/>
5252
</nuxt-link>
5353
<section

frontend/app/components/modules/project/store/project.store.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
lfxProjectDateOptions
88
} from '~/components/modules/project/config/date-options';
99
import type { Project, ProjectRepository } from '~~/types/project';
10-
import { getRepoNameFromUrl } from '~/components/modules/repository/utils/repository.helpers';
1110
import { Granularity } from '~~/types/shared/granularity';
1211

1312
const calculateGranularity = (start: string | null, end: string | null): string[] => {
@@ -42,14 +41,11 @@ export const useProjectStore = defineStore('project', () => {
4241
const startDate = ref<string | null>(lfxProjectDateOptions[0]?.startDate || null);
4342
const endDate = ref<string | null>(lfxProjectDateOptions[0]?.endDate || null);
4443
const project = ref<Project | null>(null);
45-
const projectRepos = computed<ProjectRepository[]>(() => (project.value?.repositories || []).map((repo) => ({
46-
repo,
47-
name: getRepoNameFromUrl(repo)
48-
})));
44+
const projectRepos = computed<ProjectRepository[]>(() => (project.value?.repositories || []));
4945
const selectedRepository = computed<string>(
5046
() => projectRepos.value.find(
51-
(repo: ProjectRepository) => route.params.name === repo.name
52-
)?.repo || ''
47+
(repo: ProjectRepository) => route.params.name === repo.slug
48+
)?.url || ''
5349
);
5450

5551
const customRangeGranularity = computed<string[]>(() => (startDate.value === null || endDate.value === null

frontend/app/components/shared/layout/search/search-result.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@
6666
class="flex flex-col gap-1"
6767
>
6868
<nuxt-link
69-
v-for="repository of repos"
69+
v-for="repository of props.repositories"
7070
:key="repository.slug"
71-
:to="{name: LfxRoutes.REPOSITORY, params: {name: repository.name, slug: repository.projectSlug}}"
71+
:to="{name: LfxRoutes.REPOSITORY, params: {name: repository.slug, slug: repository.projectSlug}}"
7272
class="px-3 py-2 rounded-md transition-all
7373
hover:bg-neutral-50 flex items-center gap-2 cursor-pointer text-sm text-neutral-900"
7474
>
@@ -159,7 +159,6 @@ import LfxTabs from "~/components/uikit/tabs/tabs.vue";
159159
import LfxAvatar from "~/components/uikit/avatar/avatar.vue";
160160
import LfxIcon from "~/components/uikit/icon/icon.vue";
161161
import {LfxRoutes} from "~/components/shared/types/routes";
162-
import {getRepoNameFromUrl} from "~/components/modules/repository/utils/repository.helpers";
163162
164163
const props = defineProps<{
165164
projects: SearchProject[];
@@ -171,11 +170,6 @@ const route = useRoute();
171170
172171
const tab = ref('all');
173172
174-
const repos = computed(() => props.repositories.map((repo) => ({
175-
...repo,
176-
name: getRepoNameFromUrl(repo.slug),
177-
})))
178-
179173
const noResult = computed(() => !props.projects.length && !props.repositories.length && !props.collections.length)
180174
181175
const tabs = [

frontend/app/components/uikit/tag/tag.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333

3434
/* Type */
3535
&--transparent{
36-
@apply bg-transparent px-0;
36+
@apply bg-transparent text-neutral-500 px-0;
3737
}
3838
}

frontend/app/layouts/default.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
<slot />
55
<lfx-toast theme="dark" />
66
<div class="flex-grow" />
7-
<client-only>
8-
<lfx-footer class="mx-auto pb-6 pt-6" />
9-
</client-only>
7+
<div class="container">
8+
<client-only>
9+
<lfx-footer class="pt-10 md:pt-16 pb-5 md:pb-8 px-0" />
10+
</client-only>
11+
</div>
1012
</main>
1113
</template>
1214

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"pinia": "^2.3.0",
3030
"pluralize": "^8.0.0",
3131
"primevue": "^4.2.5",
32+
"slugify": "^1.6.6",
3233
"vue": "latest",
3334
"vue-router": "latest"
3435
},

frontend/pnpm-lock.yaml

Lines changed: 11 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)