Skip to content

Commit 386355e

Browse files
Merge Add Wallet to User View
Add Wallet to User View
2 parents b280b84 + 8eaec26 commit 386355e

File tree

5 files changed

+99
-109
lines changed

5 files changed

+99
-109
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default {
6767
{ title: 'Dashboard', icon: 'mdi-view-dashboard', route: 'Dashboard', associatedRoutes: ['Dashboard'] },
6868
{ title: 'Usuarios', icon: 'mdi-account-group', route: 'Users', associatedRoutes: ['Users', 'UserDetail'] },
6969
{ title: 'Proyectos', icon: 'mdi-inbox-multiple', route: 'Projects', associatedRoutes: ['Projects', 'ProjectDetail'] },
70-
{ title: 'Transacciones', icon: 'mdi-cash-multiple', route: 'Transactions', associatedRoutes: ['Transactions'] },
70+
// { title: 'Transacciones', icon: 'mdi-cash-multiple', route: 'Transactions', associatedRoutes: ['Transactions'] },
7171
{ title: 'Métricas', icon: 'mdi-chart-pie', route: 'Metrics', associatedRoutes: ['Metrics'] },
7272
{ title: 'Servidores', icon: 'mdi-server', route: 'Servers', associatedRoutes: ['Servers'] }
7373
]

src/components/Wallet.vue

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/graphql/graphql.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,44 @@ export const PROJECT_QUERY = gql`
9797
`
9898

9999
export const USER_QUERY = gql`
100-
query ProjectQuery($id: Int) {
100+
query UserQuery($id: Int) {
101101
user(dbId: $id) {
102+
id
102103
username
103104
email
105+
imagePath
106+
firstName
107+
lastName
108+
description
109+
creationDateTime
110+
lastLogin
111+
isSeer
104112
latitude
105113
longitude
106114
isBlocked
115+
walletAddress
116+
interests {
117+
edges {
118+
node {
119+
name
120+
}
121+
}
122+
}
123+
isSeeder
124+
favoritedProjects {
125+
edges {
126+
node {
127+
project {
128+
dbId
129+
name
130+
categoryName
131+
favoriteCount
132+
}
133+
}
134+
}
135+
}
136+
isSponsor
137+
favoriteCount
107138
}
108139
}
109140
`

src/views/ProjectDetail.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<v-container v-if="loading">
2+
<v-container v-if="$apollo.queries.project.loading">
33
<v-layout row justify-center>
44
<v-container fill-height>
55
<v-layout row justify-center align-center>
@@ -195,7 +195,6 @@
195195
<v-tab href="#tab-1">Etapas</v-tab>
196196
<v-tab href="#tab-2">Patrocinadores</v-tab>
197197
<v-tab href="#tab-3">Veedores</v-tab>
198-
<v-tab href="#tab-4">Transacciones</v-tab>
199198
</v-tabs>
200199

201200
<v-divider class="mx-7"></v-divider>
@@ -260,12 +259,6 @@
260259
<v-card-text>Veedores</v-card-text>
261260
</v-card>
262261
</v-tab-item>
263-
264-
<v-tab-item value="tab-4">
265-
<v-card flat>
266-
<v-card-text>Transacciones</v-card-text>
267-
</v-card>
268-
</v-tab-item>
269262
</v-tabs-items>
270263
</v-card>
271264
</v-col>
@@ -399,9 +392,6 @@ export default {
399392
text: this.id,
400393
disabled: true
401394
}]
402-
},
403-
loading () {
404-
return this.project === undefined
405395
}
406396
},
407397

src/views/UserDetail.vue

Lines changed: 65 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<v-container v-if="loading">
2+
<v-container v-if="$apollo.queries.user.loading">
33
<v-layout row justify-center>
44
<v-container fill-height>
55
<v-layout row justify-center align-center>
@@ -32,7 +32,7 @@
3232
</v-avatar>
3333
</v-col>
3434
<v-col cols="12" class="mt-2 mb-4">
35-
<div class="overline my-0">{{ mockUser.username }}</div>
35+
<div class="overline my-0">{{ user.username }}</div>
3636
<div v-if="isSeeder"><v-chip small outlined class="my-1" color="green darken-2">Emprendedor</v-chip></div>
3737
<div v-if="isSponsor"><v-chip small outlined class="my-1" color="pink darken-1">Patrocinador</v-chip></div>
3838
<div v-if="isSeer"><v-chip small outlined class="my-1" color="amber darken-4">Veedor</v-chip></div>
@@ -90,49 +90,49 @@
9090
</v-col>
9191
<v-col cols="6" class="px-2 py-2">
9292
<v-text-field
93-
:value="mockUser.lastName"
93+
:value="user.lastName"
9494
label="APELLIDO"
9595
readonly
9696
dense
9797
></v-text-field>
9898
</v-col>
99-
</v-row>
100-
101-
<v-divider class="px-0 mx-0"></v-divider>
102-
103-
<v-row no-gutters class="mt-7">
104-
<v-col cols="8" class="px-2 py-2">
99+
<v-col cols="6" class="px-2 py-2">
105100
<v-text-field
106-
:value="mockUser.address"
107-
label="DIRECCIÓN"
108-
prepend-icon="mdi-map-marker"
101+
:value="user.creationDateTime"
102+
label="FECHA DE CREACIÓN"
103+
prepend-icon="mdi-calendar-plus"
109104
readonly
110105
dense
111106
></v-text-field>
112107
</v-col>
113-
<v-col cols="4" class="px-2 py-2">
108+
<v-col cols="6" class="px-2 py-2">
114109
<v-text-field
115-
:value="mockUser.phone"
116-
label="TELÉFONO"
117-
prepend-icon="mdi-phone"
110+
:value="user.lastLogin"
111+
label="ÚLTIMA CONEXIÓN"
112+
prepend-icon="mdi-update"
118113
readonly
119114
dense
120115
></v-text-field>
121116
</v-col>
122-
<v-col cols="6" class="px-2 py-2">
117+
</v-row>
118+
119+
<v-divider class="px-0 mx-0"></v-divider>
120+
121+
<v-row no-gutters class="mt-7">
122+
<v-col cols="8" class="px-2 py-2">
123123
<v-text-field
124-
:value="mockUser.creationDatetime"
125-
label="FECHA DE CREACIÓN"
126-
prepend-icon="mdi-calendar-plus"
124+
:value="user.walletAddress"
125+
label="Wallet"
126+
prepend-icon="mdi-wallet"
127127
readonly
128128
dense
129129
></v-text-field>
130130
</v-col>
131-
<v-col cols="6" class="px-2 py-2">
131+
<v-col cols="4" class="px-2 py-2">
132132
<v-text-field
133-
:value="mockUser.lastLogin"
134-
label="ÚLTIMA CONEXIÓN"
135-
prepend-icon="mdi-update"
133+
:value="mockUser.ethereum"
134+
label="ETH"
135+
prepend-icon="mdi-ethereum"
136136
readonly
137137
dense
138138
></v-text-field>
@@ -147,10 +147,9 @@
147147
<v-tabs v-model="tab" centered color="primary lighten-3">
148148
<v-tabs-slider></v-tabs-slider>
149149
<v-tab href="#tab-1">Perfil</v-tab>
150-
<v-tab href="#tab-2">Transacciones</v-tab>
151-
<v-tab href="#tab-3" v-if="isSeeder">Emprendedor</v-tab>
152-
<v-tab href="#tab-4" v-if="isSponsor">Patrocinador</v-tab>
153-
<v-tab href="#tab-5" v-if="isSeer">Veedor</v-tab>
150+
<v-tab href="#tab-2" v-if="isSeeder">Emprendedor</v-tab>
151+
<v-tab href="#tab-3" v-if="isSponsor">Patrocinador</v-tab>
152+
<v-tab href="#tab-4" v-if="isSeer">Veedor</v-tab>
154153
</v-tabs>
155154

156155
<v-divider class="mx-7"></v-divider>
@@ -164,20 +163,7 @@
164163
<v-row>
165164
<v-col cols="12" class="my-0 py-0">
166165
<v-card-title>Descripción</v-card-title>
167-
<v-card-text>{{ mockUser.description }}</v-card-text>
168-
</v-col>
169-
<v-col cols="12" class="my-0 py-0">
170-
<v-card-title>Intereses</v-card-title>
171-
<v-card-text>
172-
<v-chip
173-
v-for="item in mockUser.interests"
174-
:key="item"
175-
outlined
176-
class="mb-2 mr-2"
177-
>
178-
{{ item }}
179-
</v-chip>
180-
</v-card-text>
166+
<v-card-text>{{ user.description }}</v-card-text>
181167
</v-col>
182168
<v-col cols="12" class="mt-0 pt-0" v-if="user.latitude && user.longitude">
183169
<v-card-title>Ubicación</v-card-title>
@@ -189,15 +175,26 @@
189175
<v-col cols="12" xl="6">
190176
<v-row>
191177
<v-col cols="12" class="my-0 py-0">
192-
<v-card-title>Proyectos Favoritos</v-card-title>
178+
<v-card-title>Intereses</v-card-title>
193179
<v-card-text>
194-
<ProjectsTable :itemsPerPage="3"></ProjectsTable>
180+
<v-chip
181+
v-for="item in interests"
182+
:key="item"
183+
outlined
184+
class="mb-2 mr-2"
185+
>
186+
{{ item }}
187+
</v-chip>
195188
</v-card-text>
196189
</v-col>
197190
<v-col cols="12" class="my-0 py-0">
198-
<v-card-title>Proyectos Consultados</v-card-title>
191+
<v-card-title>Proyectos Favoritos ({{ user.favoriteCount }})</v-card-title>
199192
<v-card-text>
200-
<ProjectsTable :itemsPerPage="3"></ProjectsTable>
193+
<v-data-table
194+
:headers="favoriteHeaders"
195+
:items="favorites"
196+
:items-per-page="5"
197+
></v-data-table>
201198
</v-card-text>
202199
</v-col>
203200
</v-row>
@@ -207,25 +204,19 @@
207204
</v-card>
208205
</v-tab-item>
209206

210-
<v-tab-item value="tab-2">
211-
<v-card flat>
212-
<v-card-text>Transacciones</v-card-text>
213-
</v-card>
214-
</v-tab-item>
215-
216-
<v-tab-item value="tab-3" v-if="isSeeder">
207+
<v-tab-item value="tab-2" v-if="isSeeder">
217208
<v-card flat>
218209
<v-card-text>Emprendedor</v-card-text>
219210
</v-card>
220211
</v-tab-item>
221212

222-
<v-tab-item value="tab-4" v-if="isSponsor">
213+
<v-tab-item value="tab-3" v-if="isSponsor">
223214
<v-card flat>
224215
<v-card-text>Patrocinador</v-card-text>
225216
</v-card>
226217
</v-tab-item>
227218

228-
<v-tab-item value="tab-5" v-if="isSeer">
219+
<v-tab-item value="tab-4" v-if="isSeer">
229220
<v-card flat>
230221
<v-card-text>Veedor</v-card-text>
231222
</v-card>
@@ -273,13 +264,11 @@
273264

274265
<script>
275266
import Map from '@/components/Map'
276-
import ProjectsTable from '@/components/ProjectsTable'
277267
import { BLOCK_USER_MUTATION, UNBLOCK_USER_MUTATION, USER_QUERY } from '@/graphql/graphql'
278268
279269
export default {
280270
components: {
281-
Map,
282-
ProjectsTable
271+
Map
283272
},
284273
285274
name: 'UserDetail',
@@ -288,24 +277,14 @@ export default {
288277
dialog: false,
289278
tab: null,
290279
mockUser: {
291-
username: 'mgarcia',
292-
email: 'mgarcia@gmail.com',
293-
avatar: 0,
294-
firstName: 'Manuel',
295-
lastName: 'García',
296-
description: 'Divulgador científico, blogger y amante de la fotografía.',
297-
creationDatetime: '12-04-2021 18:41',
298-
lastLogin: '25-05-2021 10:12',
299-
isSeeder: true,
300-
isSponsor: true,
301-
isSeer: true,
302-
address: 'Av. Corrientes 5530, Buenos Aires, Argentina',
303-
latitude: -34.5971806,
304-
longitude: -58.4432835,
305-
phone: '+54 9 11 3271 8283',
306-
interests: ['Arte', 'Ciencia', 'Cine', 'Comida', 'Fotografía', 'Moda', 'Música', 'Tecnología', 'Teatro'],
307-
isBlocked: false
308-
}
280+
ethereum: 0.0096
281+
},
282+
favoriteHeaders: [
283+
{ text: 'ID', align: 'start', sortable: false, value: 'dbId' },
284+
{ text: 'Nombre', sortable: false, value: 'name' },
285+
{ text: 'Categoría', sortable: false, value: 'categoryName' },
286+
{ text: 'Favoritos', align: 'end', sortable: false, value: 'favoriteCount' }
287+
]
309288
}),
310289
311290
computed: {
@@ -316,13 +295,19 @@ export default {
316295
return this.user.isBlocked
317296
},
318297
isSeeder () {
319-
return this.mockUser.isSeeder
298+
return this.user.isSeeder
320299
},
321300
isSponsor () {
322-
return this.mockUser.isSponsor
301+
return this.user.isSponsor
323302
},
324303
isSeer () {
325-
return this.mockUser.isSeer
304+
return this.user.isSeer
305+
},
306+
interests () {
307+
return this.user?.interests?.edges?.map(i => i?.node?.name) || []
308+
},
309+
favorites () {
310+
return this.user?.favoritedProjects?.edges?.map(i => i?.node) || []
326311
},
327312
items () {
328313
return [{
@@ -331,12 +316,9 @@ export default {
331316
href: '../users'
332317
},
333318
{
334-
text: this.mockUser.username,
319+
text: this.user.username,
335320
disabled: true
336321
}]
337-
},
338-
loading () {
339-
return this.user === undefined
340322
}
341323
},
342324

0 commit comments

Comments
 (0)