Debian Codegraph @

addons/mail/static/src/discuss/gif_picker/common/gif_picker.xml

raw
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <templates xml:space="preserve">
3 <t t-name="discuss.GifPicker">
4 <div class="o-discuss-GifPicker d-flex flex-column" t-attf-class="{{ props.className }}" t-att-class="{ 'h-100': props.mobile }" t-on-focusin="() => state.focused = true" t-on-focusout="() => state.focused = false">
5 <div t-if="!store.hasGifPickerFeature and store.self.main_user_id?.is_admin" class="d-flex flex-column align-items-center justify-content-center m-3 h-100">
6 <span class="o-discuss-GifPicker-bigEmoji">🧑‍🍳🌶️</span>
7 <span class="fs-5 text-muted">Want to spice up your conversations with GIFs? Activate the feature in the settings!</span>
8 </div>
9 <t t-else="">
10 <div class="o-EmojiPicker-search d-flex align-items-center m-2 rounded">
11 <i t-if="!state.showCategories" aria-label="back" t-on-click="openCategories" class="oi oi-arrow-left cursor-pointer p-2 fs-5"/>
12 <span class="d-flex mx-1 w-100 rounded o-active">
13 <t t-call="discuss.GifPicker.searchInput">
14 <t t-if="props.state" t-set="localState" t-value="props.state"/>
15 <t t-else="" t-set="localState" t-value="state"/>
16 </t>
17 <i class="oi oi-search p-2 fs-5 rounded-start-0 rounded-3 o-active" title="Search..." role="img" aria-label="Search..."/>
18 </span>
19 </div>
20 <div class="o-discuss-GifPicker-content overflow-y-auto overflow-x-hidden ps-2 pe-3 pb-2 h-100" t-ref="scroller">
21 <div t-if="state.loadingError" class="text-center">
22 <span class="o-discuss-GifPicker-error d-block">😵‍💫</span>
23 <span class="fs-5 text-muted d-block">Failed to load gifs...</span>
24 </div>
25 <div t-if="state.showCategories and !state.loadingError" class="row row-cols-2 gy-2 gx-2" aria-label="list">
26 <div t-if="store.self_partner" class="col">
27 <div class="position-relative ratio ratio-16x9 cursor-pointer rounded overflow-hidden" t-on-click="onClickFavoritesCategory" aria-label="list-item">
28 <img
29 t-if="state.favorites.gifs.length > 0"
30 class="o-discuss-GifPicker-category"
31 t-att-src="state.favorites.gifs[0].media_formats.tinygif.url"
32 loading="lazy"
33 alt="GIF Favorites"
34 />
35 <div class="position-absolute w-100 h-100 top-0 start-0 text-center o-text-white align-middle fs-2 o-bg-black bg-opacity-50">
36 Favorites
37 </div>
38 </div>
39 </div>
40 <t t-if="state.categories.length === 0">
41 <t t-foreach="Array(10).keys()" t-as="category" t-key="category_index">
42 <div class="col">
43 <div class="position-relative ratio ratio-16x9 cursor-pointer rounded overflow-hidden" aria-label="list-item">
44 <div class="position-absolute w-100 h-100 top-0 start-0 text-center o-text-white align-middle fs-2 o-bg-black bg-opacity-50"/>
45 </div>
46 </div>
47 </t>
48 </t>
49 <t t-else="">
50 <t t-foreach="state.categories" t-as="category" t-key="category_index">
51 <div class="col">
52 <div class="position-relative ratio ratio-16x9 cursor-pointer rounded overflow-hidden" t-on-click="() => this.onClickCategory(category)" aria-label="list-item">
53 <img class="o-discuss-GifPickerCategory-img img-fluid" t-att-src="category.image" loading="lazy" alt="GIF Category"/>
54 <div class="position-absolute w-100 h-100 top-0 start-0 text-center o-text-white align-middle fs-2 o-bg-black bg-opacity-50">
55 <t t-out="category.name"/>
56 </div>
57 </div>
58 </div>
59 </t>
60 </t>
61 </div>
62 <t t-if="!state.showCategories">
63 <div class="d-flex gap-1">
64 <div>
65 <t t-foreach="state.evenGif.gifs" t-as="gif" t-key="gif_index">
66 <t t-call="discuss.GifPicker.gif"/>
67 </t>
68 </div>
69 <div>
70 <t t-foreach="state.oddGif.gifs" t-as="gif" t-key="gif_index">
71 <t t-call="discuss.GifPicker.gif"/>
72 </t>
73 </div>
74 </div>
75 <div t-if="state.loadingGif" class="text-center fs-6 h-100 d-flex flex-column justify-content-center">
76 <i class="fa fa-spin fa-circle-o-notch"/>
77 </div>
78 <div t-elif="showFavorite and state.evenGif.gifs.size === 0 and state.oddGif.gifs.size === 0" class="d-flex flex-column h-100 align-items-center justify-content-center text-center text-muted gap-2">
79 <i class="o-discuss-GifPicker-noFavoritesIcon o-yellow fa fa-star fs-1"/>
80 <span class="fs-5">So uhh... maybe go favorite some GIFs?</span>
81 </div>
82 </t>
83 </div>
84 </t>
85 </div>
86 </t>
87
88 <t t-name="discuss.GifPicker.gif">
89 <div class="o-discuss-Gif position-relative mt-1 fs-5 cursor-pointer rounded overflow-hidden">
90 <i
91 t-if="store.self_partner"
92 class="position-absolute top-0 end-0 me-3 mt-3 p-2 o-bg-black bg-opacity-75 fa cursor-pointer opacity-0"
93 t-att-class="{ 'o-text-white fa-star-o': !isFavorite(gif_value), 'fa-star o-starred': isFavorite(gif_value) }"
94 t-on-click="() => this.onClickFavorite(gif_value)"
95 />
96 <Gif class="'img-fluid'" style="style" alt="'GIF'" onClick="() => this.onClickGif(gif_value)" src="gif_value.media_formats.tinygif.url" loading="'lazy'" paused="!state.focused"/>
97 </div>
98 </t>
99
100 <t t-name="discuss.GifPicker.searchInput">
101 <input class="form-control border-0 flex-grow-1 rounded-3 rounded-end-0 o-active" placeholder="Search for a GIF" t-model="localState.searchTerm" t-ref="autofocus" />
102 </t>
103 </templates>