File size: 4,307 Bytes
7e66729
 
a95192f
 
7e66729
a95192f
 
 
 
 
bf652e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a95192f
 
 
 
 
bf652e3
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
bf652e3
 
 
a95192f
 
 
 
 
7e66729
 
 
 
 
 
 
a95192f
 
7e66729
a95192f
 
7e66729
f2bead0
bf652e3
7e66729
 
 
 
2cb2b62
7e66729
a95192f
 
 
7e66729
 
a95192f
 
 
 
7e66729
 
bf652e3
 
 
 
 
a95192f
 
 
 
 
 
f2bead0
 
 
 
a95192f
7e66729
a95192f
 
 
 
7e66729
a95192f
 
 
 
2cb2b62
 
a95192f
 
 
 
 
7e66729
 
a95192f
7e66729
a95192f
 
 
 
7e66729
 
 
a95192f
 
 
 
 
 
 
 
 
 
bf652e3
 
 
 
 
 
 
 
 
 
 
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e66729
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<template>
  <v-col cols="12" md="4">

    <!-- History -->
    <v-card class="panel-card" rounded="xl" elevation="0">
      <div class="panel-header px-4 pt-4 pb-2">
        <div class="panel-label">
          <v-icon size="14" color="amber-darken-1" class="mr-1">mdi-filmstrip</v-icon>
          Visto recientemente
        </div>
        <div class="header-actions">
          <v-btn
            v-if="history.length"
            size="x-small"
            variant="text"
            color="primary"
            class="mr-1"
            @click="emit('show-all-history')"
          >
            Ver todo
          </v-btn>
          <v-btn
            size="x-small"
            variant="tonal"
            color="error"
            icon
            :disabled="!history.length || clearLoading"
            title="Borrar historial"
            @click="emit('clear-history')"
          >
            <v-icon size="15">mdi-delete-sweep-outline</v-icon>
          </v-btn>
        </div>
      </div>

      <v-card-text class="pt-1 pb-3">
        <template v-if="history.length">
          <div
            v-for="item in history.slice(0, 3)"
            :key="item.id"
            class="history-item"
          >
            <span class="history-emoji">{{ emotionInfoBySpanish(item.emotion).emoji }}</span>
            <div class="history-body">
              <div class="history-movie">{{ item.title || item.movie_id }}</div>
              <div class="history-meta">
                <span>{{ item.emotion || "neutral" }}</span>
                <span v-if="item.user_rating != null" class="history-rating">
                  {{ item.user_rating }}
                </span>
              </div>
            </div>
          </div>
          <div v-if="history.length > 3" class="more-hint" @click="emit('show-all-history')">
            +{{ history.length - 3 }} más
          </div>
        </template>
        <div v-else class="empty-history">
          <v-icon size="26" color="blue-grey" class="mb-2">mdi-movie-open-outline</v-icon>
          <p>Aún no has marcado ninguna película como vista.</p>
        </div>
      </v-card-text>
    </v-card>

  </v-col>
</template>

<script setup>
import { emotionInfoBySpanish } from "../constants/emotions";

defineProps({
  history:      { type: Array,   default: () => [] },
  clearLoading: { type: Boolean, default: false },
});

const emit = defineEmits(["clear-history", "show-all-history"]);
</script>

<style scoped>
.panel-card {
  border: 1.5px solid var(--vs-border);
  background: var(--vs-panel);
  backdrop-filter: blur(var(--vs-glass-blur)) saturate(120%);
  -webkit-backdrop-filter: blur(var(--vs-glass-blur)) saturate(120%);
  box-shadow: var(--vs-card-shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-actions {
  display: flex;
  align-items: center;
}

.panel-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--vs-muted);
  display: flex;
  align-items: center;
}

/* History */
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 4px;
  background: var(--vs-movie-bg);
  border: 1px solid var(--vs-border);
  transition: background 0.18s ease;
}

.history-item:hover { background: var(--vs-movie-hover); }

.history-emoji { font-size: 1.1rem; line-height: 1.4; flex-shrink: 0; }

.history-body  { min-width: 0; }

.history-movie {
  color: var(--vs-text);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--vs-muted);
  margin-top: 1px;
}

.history-rating { color: #F59E0B; font-weight: 600; }

.more-hint {
  font-size: 0.76rem;
  color: var(--vs-muted);
  text-align: center;
  padding: 6px 0 2px;
  cursor: pointer;
  transition: color 0.15s;
}

.more-hint:hover { color: var(--vs-text); }

.empty-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  text-align: center;
}

.empty-history p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--vs-muted);
  max-width: 22ch;
  line-height: 1.5;
}
</style>