Skip to content

Commit e4f4703

Browse files
committed
homepage update
1 parent 92d2355 commit e4f4703

19 files changed

+308
-207
lines changed

README.md

+3-45
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
# properties-vue3
22

3-
This template should help get you started developing with Vue 3 in Vite.
3+
This project is the frontend side for the <a href="https://github.com/robuedi/properties-api">properties API app</a>
44

5-
## Recommended IDE Setup
5+
## Screenshot
66

7-
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8-
9-
## Type Support for `.vue` Imports in TS
10-
11-
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
12-
13-
## Customize configuration
14-
15-
See [Vite Configuration Reference](https://vite.dev/config/).
7+
![Screenshot](/screenshot.png)
168

179
## Project Setup
1810

@@ -25,37 +17,3 @@ npm install
2517
```sh
2618
npm run dev
2719
```
28-
29-
### Type-Check, Compile and Minify for Production
30-
31-
```sh
32-
npm run build
33-
```
34-
35-
### Run Unit Tests with [Vitest](https://vitest.dev/)
36-
37-
```sh
38-
npm run test:unit
39-
```
40-
41-
### Run End-to-End Tests with [Cypress](https://www.cypress.io/)
42-
43-
```sh
44-
npm run test:e2e:dev
45-
```
46-
47-
This runs the end-to-end tests against the Vite development server.
48-
It is much faster than the production build.
49-
50-
But it's still recommended to test the production build with `test:e2e` before deploying (e.g. in CI environments):
51-
52-
```sh
53-
npm run build
54-
npm run test:e2e
55-
```
56-
57-
### Lint with [ESLint](https://eslint.org/)
58-
59-
```sh
60-
npm run lint
61-
```

components.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ declare module 'vue' {
1515
Chart: typeof import('primevue/chart')['default']
1616
Column: typeof import('primevue/column')['default']
1717
DataTable: typeof import('primevue/datatable')['default']
18+
DataView: typeof import('primevue/dataview')['default']
1819
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
1920
IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
2021
IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default']
@@ -24,14 +25,21 @@ declare module 'vue' {
2425
Menu: typeof import('primevue/menu')['default']
2526
Menubar: typeof import('primevue/menubar')['default']
2627
NotificationsWidget: typeof import('./src/components/dashboard/NotificationsWidget.vue')['default']
28+
Paginator: typeof import('primevue/paginator')['default']
2729
Panel: typeof import('primevue/panel')['default']
2830
PropertiesList: typeof import('./src/components/properties/PropertiesList.vue')['default']
31+
PropertItemListLoadingPlaceholder: typeof import('./src/components/properties/PropertItemListLoadingPlaceholder.vue')['default']
32+
PropertyItemList: typeof import('./src/components/properties/PropertyItemList.vue')['default']
33+
PropertyIten: typeof import('./src/components/properties/PropertyIten.vue')['default']
2934
RecentSalesWidget: typeof import('./src/components/dashboard/RecentSalesWidget.vue')['default']
3035
RevenueStreamWidget: typeof import('./src/components/dashboard/RevenueStreamWidget.vue')['default']
3136
RouterLink: typeof import('vue-router')['RouterLink']
3237
RouterView: typeof import('vue-router')['RouterView']
38+
Select: typeof import('primevue/select')['default']
3339
SelectButton: typeof import('primevue/selectbutton')['default']
40+
Skeleton: typeof import('primevue/skeleton')['default']
3441
StatsWidget: typeof import('./src/components/dashboard/StatsWidget.vue')['default']
42+
Tag: typeof import('primevue/tag')['default']
3543
TheWelcome: typeof import('./src/components/TheWelcome.vue')['default']
3644
Toast: typeof import('primevue/toast')['default']
3745
WelcomeItem: typeof import('./src/components/WelcomeItem.vue')['default']

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="icon" href="/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<link href="https://fonts.cdnfonts.com/css/lato" rel="stylesheet" />
8-
<title>Vite App</title>
8+
<title>Properties V3</title>
99
</head>
1010
<body>
1111
<div id="app"></div>

public/img/house-placeholder.jpg

60.2 KB
Loading

screenshot.png

380 KB
Loading

src/assets_/base.css

-86
This file was deleted.

src/assets_/logo.svg

-1
This file was deleted.

src/assets_/main.css

-35
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<script setup lang="ts">
2+
defineProps<{
3+
index?: number
4+
}>()
5+
</script>
6+
7+
<template>
8+
<div>
9+
<div
10+
class="flex flex-col xl:flex-row xl:items-start p-6 gap-6"
11+
:class="{ 'border-t border-surface-200 dark:border-surface-700': index !== 0 }"
12+
>
13+
<Skeleton class="!w-9/12 sm:!w-64 xl:!w-40 !h-24 mx-auto" />
14+
<div
15+
class="flex flex-col sm:flex-row justify-between items-center xl:items-start flex-1 gap-6"
16+
>
17+
<div class="flex flex-col items-center sm:items-start gap-4">
18+
<Skeleton width="8rem" height="2rem" />
19+
<Skeleton width="6rem" height="1rem" />
20+
21+
<div class="flex items-center gap-4">
22+
<Skeleton width="6rem" height="1rem" />
23+
<Skeleton width="3rem" height="1rem" />
24+
</div>
25+
</div>
26+
<div class="flex sm:flex-col items-center sm:items-end gap-4 sm:gap-2">
27+
<Skeleton width="4rem" height="2rem" />
28+
<Skeleton size="3rem" shape="circle" />
29+
</div>
30+
</div>
31+
</div>
32+
</div>
33+
</template>
+95-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,104 @@
11
<script setup lang="ts">
22
import { usePropertyStore } from '@/stores/property.store'
3+
import Property from '@/models/Property'
4+
import Model from '@/models/Model'
5+
import PropertyItemList from '@/components/properties/PropertyItemList.vue'
6+
import PropertItemListLoadingPlaceholder from '@/components/properties/PropertItemListLoadingPlaceholder.vue'
7+
import { onMounted, ref, watch } from 'vue'
8+
39
//make the storee
410
const propertyStore = usePropertyStore()
11+
const paginationLimit = ref(5)
12+
const paginationPage = ref(1)
13+
14+
const sortKey = ref({ label: 'Newest', value: '-created_at' })
15+
const sortOrder = ref()
16+
const sortField = ref('-created_at')
17+
const sortOptions = ref([
18+
{ label: 'Newest', value: '-created_at' },
19+
{ label: 'Oldest', value: 'created_at' },
20+
])
21+
const onSortChange = (event) => {
22+
const value = event.value.value
23+
const sortValue = event.value
24+
25+
if (value.indexOf('!') === 0) {
26+
sortOrder.value = -1
27+
sortField.value = value.substring(1, value.length)
28+
sortKey.value = sortValue
29+
} else {
30+
sortOrder.value = 1
31+
sortField.value = value
32+
sortKey.value = sortValue
33+
}
34+
}
35+
36+
//make data request
37+
const makeDataRequest = () => {
38+
const properties = Property.select('id', 'name', 'price', 'created_at')
39+
.include('address.city.country')
40+
.limit(paginationLimit.value)
41+
.page(paginationPage.value)
42+
.orderBy(sortKey.value.value)
43+
44+
propertyStore.getAll(properties)
45+
}
46+
47+
//reload on limit, page change
48+
watch([paginationLimit, paginationPage, sortKey], () => {
49+
makeDataRequest()
50+
})
51+
52+
const rowsChanged = function (rowsNumber: number) {
53+
paginationLimit.value = rowsNumber
54+
}
55+
56+
const pageStateChange = function (pageState: { page: number }) {
57+
paginationPage.value = ++pageState.page
58+
}
59+
60+
onMounted(() => {
61+
makeDataRequest()
62+
})
563
</script>
664

765
<template>
8-
<div>
9-
<p v-for="property in propertyStore.properties" :key="property.id">
10-
{{ property.name }}
11-
</p>
66+
<div class="card">
67+
<DataView
68+
:value="propertyStore.propertiesListing.data"
69+
:sortOrder="sortOrder"
70+
:sortField="sortField"
71+
>
72+
<template #header>
73+
<Select
74+
v-model="sortKey"
75+
:options="sortOptions"
76+
optionLabel="label"
77+
placeholder="Sort By Date"
78+
@change="onSortChange($event)"
79+
/>
80+
</template>
81+
<template #list="slotProps">
82+
<div class="flex flex-col">
83+
<template v-if="propertyStore.propertiesListing.apiState === Model.state.LOADING">
84+
<PropertItemListLoadingPlaceholder v-for="i in paginationLimit" :key="i" :index="i" />
85+
</template>
86+
<PropertyItemList
87+
v-else
88+
v-for="(item, index) in slotProps.items"
89+
:property="item"
90+
:index="index"
91+
:key="index"
92+
/>
93+
</div>
94+
</template>
95+
</DataView>
96+
<Paginator
97+
@page="pageStateChange"
98+
@update:rows="rowsChanged"
99+
:rows="propertyStore.propertiesListing.meta.per_page"
100+
:totalRecords="propertyStore.propertiesListing.meta.total"
101+
:rowsPerPageOptions="[5, 10, 20, 30]"
102+
></Paginator>
12103
</div>
13104
</template>

0 commit comments

Comments
 (0)