decord/source/modules/gif_picker/FavoriteGIFHooks.tsx

79 lines
2.3 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10238
// Function ID: 10239
2026-07-20 16:05:17 +00:00
// Name: useFavoriteGIFs
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 10239, 12, 2]
2026-07-29 08:29:29 +00:00
// Exports: useFavoriteGIFs, useIsFavoriteGIF, useShouldShowTooltipOnFavorite, useSortedFavoriteGIFs
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 10238 (useFavoriteGIFs)
import useFrecencySettings from "useFrecencySettings" /* 10239 */;
import closure_3 from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
let closure_4 = {};
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/gif_picker/FavoriteGIFHooks.tsx");
2026-07-29 08:29:29 +00:00
export const useFavoriteGIFs = function useFavoriteGIFs() {
2026-08-24 06:08:38 +00:00
const favoriteGifs = useFrecencySettings.useFrecencySettings().favoriteGifs;
2026-07-20 16:05:17 +00:00
let gifs;
2026-07-29 08:29:29 +00:00
if (favoriteGifs != null) {
2026-07-20 16:05:17 +00:00
gifs = favoriteGifs.gifs;
}
2026-07-29 08:29:29 +00:00
if (gifs == null) {
2026-07-20 16:05:17 +00:00
gifs = closure_4;
}
return gifs;
2026-07-29 08:29:29 +00:00
};
2026-07-20 16:05:17 +00:00
export const useSortedFavoriteGIFs = function useSortedFavoriteGIFs(transformFavoriteGifUrl) {
2026-07-29 08:29:29 +00:00
const _require = transformFavoriteGifUrl;
2026-08-24 06:08:38 +00:00
const favoriteGifs = _require(10239).useFrecencySettings().favoriteGifs;
2026-07-29 08:29:29 +00:00
let gifs;
if (favoriteGifs != null) {
gifs = favoriteGifs.gifs;
}
if (gifs == null) {
gifs = closure_4;
}
const items = [gifs, transformFavoriteGifUrl];
2026-07-20 16:05:17 +00:00
return React.useMemo(() => {
2026-08-24 06:08:38 +00:00
const mapped = gifs(closure_1_2[2])(gifs).map((src, url) => {
2026-07-20 16:05:17 +00:00
const obj = {};
const merged = Object.assign(src);
2026-07-29 08:29:29 +00:00
obj.url = url;
2026-07-20 16:05:17 +00:00
src = undefined;
2026-07-29 08:29:29 +00:00
if (closure_0 != null) {
src = tmp2(src.src, url);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (src == null) {
2026-07-20 16:05:17 +00:00
src = src.src;
}
2026-07-29 08:29:29 +00:00
obj.src = src;
2026-07-20 16:05:17 +00:00
return obj;
});
2026-08-24 06:08:38 +00:00
const arr = gifs(closure_1_2[2])(gifs);
2026-07-20 16:05:17 +00:00
const sortByResult = mapped.sortBy("order");
return mapped.sortBy("order").reverse().value();
}, items);
};
export const useShouldShowTooltipOnFavorite = function useShouldShowTooltipOnFavorite() {
2026-08-24 06:08:38 +00:00
const favoriteGifs = useFrecencySettings.useFrecencySettings().favoriteGifs;
2026-07-29 08:29:29 +00:00
let flag;
if (favoriteGifs != null) {
flag = favoriteGifs.hideTooltip;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (flag == null) {
flag = false;
}
return flag;
2026-07-20 16:05:17 +00:00
};
export const useIsFavoriteGIF = function useIsFavoriteGIF(arg0) {
2026-08-24 06:08:38 +00:00
const favoriteGifs = useFrecencySettings.useFrecencySettings().favoriteGifs;
2026-07-29 08:29:29 +00:00
let gifs;
if (favoriteGifs != null) {
gifs = favoriteGifs.gifs;
}
if (gifs == null) {
gifs = closure_4;
}
return null != gifs[arg0];
2026-07-20 16:05:17 +00:00
};