File size: 6,000 Bytes
b4f9490
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3890d0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b4f9490
 
 
 
 
 
 
 
 
 
 
 
3890d0d
 
b4f9490
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3890d0d
 
 
 
b4f9490
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3890d0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b4f9490
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<template>

  <div class="segmentation-sidebar">

    <button class="upload-video-btn" @click="uploadVideo">

      <span>Upload Video</span>

      <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor">

        <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>

        <path d="m17 8-5-5-5 5"/>

        <path d="M12 3v12"/>

      </svg>

    </button>

    

    <!-- Input file caché -->

    <input 

      ref="fileInput" 

      type="file" 

      accept="video/*" 

      @change="handleVideoUpload" 

      style="display: none;"

    />



    <div class="video-list" v-if="videoStore.videos.length">

      <div 

        v-for="video in videoStore.videos" 

        :key="video.path"

        class="video-item"

        :class="{ active: videoStore.selectedVideo?.path === video.path }"

        @click="selectVideo(video)"

      >

        {{ video.name }}

      </div>

    </div>



    <!-- Sélecteur de FPS -->

    <div class="fps-selector">

      <select 

        id="fps-select"

        v-model="selectedFps" 

        @change="updateFps"

        class="fps-select"

      >

        <option value="15">15 FPS</option>

        <option value="24">24 FPS</option>

        <option value="25">25 FPS</option>

        <option value="30">30 FPS</option>

        <option value="50">50 FPS</option>

        <option value="60">60 FPS</option>

        <option value="120">120 FPS</option>

      </select>

    </div>



  </div>

</template>



<script>

import { useVideoStore } from '../stores/videoStore'



export default {

  name: 'SegmentationSidebar',



  data() {

    const videoStore = useVideoStore()

    return {

      videoStore,

      selectedFps: videoStore.fps || 25 // Utiliser la valeur du store ou 25 par défaut

    }

  },



  watch: {

    'videoStore.selectedVideo': {

      handler(newVideo) {

        console.log('Vidéo sélectionnée:', newVideo)

      },

      deep: true

    }

  },



  mounted() {

    // Plus besoin de charger un dossier par défaut - l'utilisateur uploadera une vidéo

    console.log('SegmentationSidebar mounted - prêt pour l\'upload de vidéo')

  },



  methods: {

    uploadVideo() {

      // Déclencher le clic sur l'input file caché

      this.$refs.fileInput.click()

    },



    handleVideoUpload(event) {

      const file = event.target.files[0]

      if (file) {

        console.log('Vidéo sélectionnée:', file.name)

        

        // Créer un URL blob pour la vidéo

        const videoUrl = URL.createObjectURL(file)

        

        // Créer un objet vidéo pour le store

        const videoObject = {

          name: file.name,

          path: videoUrl,

          file: file,

          size: file.size,

          type: file.type

        }

        

        // Mettre à jour le store avec la nouvelle vidéo

        this.videoStore.setVideos([videoObject])

        this.videoStore.setSelectedVideo(videoObject)

        

        // Émettre l'événement pour informer les autres composants

        this.$emit('video-selected', videoObject)

        

        console.log('Vidéo uploadée et sélectionnée:', videoObject)

      }

    },



    selectVideo(video) {

      this.videoStore.setSelectedVideo(video)

      this.$emit('video-selected', video)

    },



    updateFps() {

      this.videoStore.setFps(parseInt(this.selectedFps))

    }

  }

}

</script>



<style scoped>

.segmentation-sidebar {

  background: #363636;

  height: 100%;

  width: 200px;

  padding: 16px;

  display: flex;

  flex-direction: column;

  gap: 16px;

}



.navigation-menu {

  display: flex;

  flex-direction: column;

  gap: 8px;

  margin-bottom: 8px;

}



.nav-item {

  display: flex;

  align-items: center;

  padding: 12px;

  color: white;

  text-decoration: none;

  border-radius: 8px;

  transition: all 0.2s ease;

  background: #424242;

}



.nav-item:hover {

  background: #4a4a4a;

}



.nav-item.active {

  background: #3a3a3a;

  color: #4CAF50;

}



.nav-icon {

  margin-right: 12px;

  font-size: 1.2rem;

}



.nav-text {

  font-size: 0.9rem;

}



.upload-video-btn {

  background: #424242;

  border: none;

  border-radius: 8px;

  color: white;

  padding: 12px 16px;

  cursor: pointer;

  display: flex;

  align-items: center;

  justify-content: space-between;

  width: 100%;

  font-size: 1rem;

  flex-shrink: 0;

  transition: background-color 0.2s ease;

}



.upload-video-btn:hover {

  background: #4a4a4a;

}



.video-list {

  height: 20vh;

  background: #424242;

  border-radius: 8px;

  overflow-y: auto;

  display: flex;

  flex-direction: column;

  gap: 4px;

  padding: 4px;

}



/* Styles pour Firefox */

.video-list {

  scrollbar-width: thin;

  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;

}



/* Styles pour Chrome/Safari/Edge */

.video-list::-webkit-scrollbar {

  width: 4px;

}



.video-list::-webkit-scrollbar-track {

  background: transparent;

}



.video-list::-webkit-scrollbar-thumb {

  background: rgba(255, 255, 255, 0.3);

  border-radius: 2px;

}



.video-item {

  padding: 8px 12px;

  border-radius: 4px;

  cursor: pointer;

  color: white;

  transition: background-color 0.2s;

}



.video-item:hover {

  background: #4a4a4a;

}



.video-item.active {

  background: #3a3a3a;

}



.fps-selector {

  display: flex;

  flex-direction: column;

  gap: 8px;

  padding: 12px;

  border-radius: 8px;

}



.fps-label {

  color: white;

  font-size: 0.9rem;

  font-weight: 500;

}



.fps-select {

  background: #363636;

  border: 1px solid #555;

  border-radius: 4px;

  color: white;

  padding: 8px;

  font-size: 0.9rem;

  cursor: pointer;

  transition: border-color 0.2s ease;

}



.fps-select:hover {

  border-color: #777;

}



.fps-select:focus {

  outline: none;

  border-color: #4CAF50;

}



.fps-select option {

  background: #363636;

  color: white;

}

</style>