enzostvs HF staff commited on
Commit
d3c7901
β€’
1 Parent(s): 0e53d5c

add model to the image drawer

Browse files
src/lib/components/community/drawer/Drawer.svelte CHANGED
@@ -45,6 +45,12 @@
45
  handleClose();
46
  }
47
  };
 
 
 
 
 
 
48
  </script>
49
 
50
  <div
@@ -76,11 +82,26 @@
76
  <Icon icon="carbon:close" class="w-6 h-6 text-white cursor-pointer" />
77
  </button>
78
  </header>
79
- <main class="w-full grid grid-cols-1 gap-5">
80
- <div class="w-full">
81
  <Reactions reactions={gallery?.reactions} gallery_id={gallery.id} />
82
  </div>
83
- <img src="/api/images/{gallery?.image}" class="max-w-[450px] w-full h-[450px] bg-neutral-800 object-cover rounded-xl" alt={gallery?.prompt} />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  <div class="px-2">
85
  <p class="text-neutral-400 font-semibold text-xs uppercase">
86
  Prompt
 
45
  handleClose();
46
  }
47
  };
48
+ const handleClickModel = (id?: string) => {
49
+ if (!id) return;
50
+ $page.url.searchParams.set('model', id);
51
+ $page.url.searchParams.delete('gallery');
52
+ goto(`/?${$page.url.searchParams.toString()}`);
53
+ };
54
  </script>
55
 
56
  <div
 
82
  <Icon icon="carbon:close" class="w-6 h-6 text-white cursor-pointer" />
83
  </button>
84
  </header>
85
+ <main class="w-full grid grid-cols-2 gap-5">
86
+ <div class="w-full col-span-2">
87
  <Reactions reactions={gallery?.reactions} gallery_id={gallery.id} />
88
  </div>
89
+ <img src="/api/images/{gallery?.image}" class="max-w-[450px] w-full h-[450px] bg-neutral-800 object-cover rounded-xl col-span-2" alt={gallery?.prompt} />
90
+ <div class="col-span-2">
91
+ <button
92
+ class="flex items-center justify-start gap-4 cursor-pointer w-full text-left transition-all duration-200 hover:bg-neutral-900 p-3 group relative rounded-lg"
93
+ on:click={() => handleClickModel(gallery?.model?.id)}
94
+ >
95
+ <img src={gallery?.model?.image} alt={gallery?.model?.id} class="w-14 h-14 rounded-lg object-cover" />
96
+ <div>
97
+ <p class="text-neutral-200 text-base font-medium">{gallery?.model?.id}</p>
98
+ <p class="text-neutral-400 text-sm">{gallery?.model?.id}</p>
99
+ </div>
100
+ <div class="rounded-full absolute top-1/2 -translate-y-1/2 text-neutral-100 w-8 h-8 right-4 bg-pink-500 flex items-center justify-center transition-all duration-200 group-hover:opacity-100 opacity-0">
101
+ <Icon icon="tabler:arrow-up" class="w-5 h-5 transform rotate-45 font-bold" />
102
+ </div>
103
+ </button>
104
+ </div>
105
  <div class="px-2">
106
  <p class="text-neutral-400 font-semibold text-xs uppercase">
107
  Prompt