Skip to content

Commit 25613d5

Browse files
grv-saini-20sosweetham
authored andcommitted
fix: edit image with pencil icon
1 parent cf4617d commit 25613d5

File tree

1 file changed

+25
-11
lines changed
  • platforms/pictique/src/routes/(protected)/group/[id]

1 file changed

+25
-11
lines changed

platforms/pictique/src/routes/(protected)/group/[id]/+page.svelte

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import { page } from '$app/state';
77
import Settings from '$lib/icons/Settings.svelte';
88
import { clickOutside } from '$lib/utils';
9+
import { Pen01FreeIcons } from '@hugeicons/core-free-icons';
10+
import {HugeiconsIcon} from "@hugeicons/svelte"
911
1012
let messagesContainer: HTMLDivElement;
1113
let messageValue = $state('');
@@ -153,21 +155,30 @@
153155
class="w-[90vw] md:max-w-[30vw] z-50 absolute start-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%] p-4 border border-gray-400 rounded-3xl bg-white shadow-xl"
154156
>
155157
<div class="flex flex-col gap-6">
156-
<div>
158+
<!-- Group Avatar with Edit Icon -->
159+
<div class="relative w-[96px] h-[96px] self-center">
160+
<img
161+
src={groupImageDataUrl || '/images/avatar-placeholder.png'}
162+
alt="Group Avatar"
163+
class="w-full h-full object-cover rounded-full border border-gray-300"
164+
/>
157165
{#if canEdit}
158-
<InputFile
159-
bind:files={groupImageFiles}
166+
<!-- Hidden file input trigger -->
167+
<input
168+
type="file"
160169
accept="image/*"
161-
label="Upload Group Avatar"
162-
cancelLabel="Remove"
163-
oncancel={() => {
164-
groupImageDataUrl = '';
165-
groupImageFiles = undefined;
170+
class="hidden"
171+
id="group-avatar-input"
172+
onchange={(e) => {
173+
const files = (e.target as HTMLInputElement).files;
174+
if (files && files[0]) {
175+
groupImageFiles = files;
176+
}
166177
}}
167178
/>
168-
{/if}
169-
{#if groupImageDataUrl}
170-
<Avatar class="mt-4" src={groupImageDataUrl} alt="Group preview" size="lg" />
179+
<label for="group-avatar-input" class="absolute bottom-0 right-0 bg-brand-burnt-orange border border-brand-burnt-orange rounded-full p-1 shadow cursor-pointer">
180+
<HugeiconsIcon icon={Pen01FreeIcons} color="white"/>
181+
</label>
171182
{/if}
172183
</div>
173184

@@ -180,6 +191,7 @@
180191
{/if}
181192
</div>
182193

194+
<!-- Group Description -->
183195
<div>
184196
<Label>Description</Label>
185197
{#if canEdit}
@@ -190,6 +202,7 @@
190202
</div>
191203

192204
<hr class="text-grey" />
205+
193206
<div class="flex items-center gap-2">
194207
<Button size="sm" variant="primary" callback={() => {(openEditDialog = false)}}>Cancel</Button>
195208
{#if canEdit}
@@ -198,3 +211,4 @@
198211
</div>
199212
</div>
200213
</dialog>
214+

0 commit comments

Comments
 (0)