-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/mobile upload flow #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 21 commits
59e9812
9e0f554
7ac4cff
2a0baf1
5856dcb
4e9a762
468db66
f1e5ad4
78e648d
cdfb4d4
ae3ba2d
89ac7ed
2a1eb67
16046c9
bb019ac
7ed4214
74b859c
dabf6b9
73841de
9720ae8
8c32220
7f3a1a5
e659343
18e135d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
import type { PostData } from '$lib/types'; | ||
import type { PostData } from "$lib/types"; | ||
|
||
export const isNavigatingThroughNav = $state({ | ||
value: false | ||
value: false, | ||
}); | ||
|
||
export const showComments = $state({ | ||
value: false | ||
value: false, | ||
}); | ||
|
||
export const ownerId = $state({ | ||
value: '1' | ||
value: "1", | ||
}); | ||
|
||
export const selectedPost: { value: PostData | null } = $state({ | ||
value: null | ||
value: null, | ||
}); | ||
|
||
export const uploadedImages: { value: { url: string; alt: string }[] | null } = | ||
$state({ | ||
value: null, | ||
}); | ||
Sahil2004 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
export const audience: { value: string } = $state({ | ||
value: "Everyone", | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script lang="ts"> | ||
import { goto } from '$app/navigation'; | ||
import { SettingsTile, UploadedPostView } from '$lib/fragments'; | ||
import { audience, uploadedImages } from '$lib/store/store.svelte'; | ||
import { Button, Textarea } from '$lib/ui'; | ||
|
||
let caption: string = $state(''); | ||
|
||
$effect(() => { | ||
if (!uploadedImages.value || uploadedImages.value.length === 0) { | ||
window.history.back(); | ||
} | ||
}) | ||
Comment on lines
+10
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Potential navigation issue with history.back(). Using -window.history.back();
+goto('/home'); This ensures users are redirected to a known safe route instead of relying on browser history.
🤖 Prompt for AI Agents
|
||
</script> | ||
|
||
<section class="h-fit w-full flex flex-col gap-3 justify-stretch"> | ||
<UploadedPostView | ||
images={uploadedImages.value ?? []} | ||
width="w-auto" | ||
height="h-40" | ||
callback={(i: number) => { | ||
if (uploadedImages.value) | ||
uploadedImages.value = uploadedImages.value.filter((_, index) => index !== i); | ||
}} | ||
/> | ||
|
||
<label for="caption"> | ||
<span class="block mb-2 font-semibold">Add a caption</span> | ||
<Textarea name="caption" rows={3} bind:value={caption} placeholder="Hey guys..." /> | ||
</label> | ||
|
||
<SettingsTile | ||
title="Who can see your posts?" | ||
currentStatus={audience.value} | ||
onclick={() => goto('/post/audience')} | ||
/> | ||
|
||
<Button variant="secondary" callback={() => alert('TODO: Post created!')} class="mt-1">Post</Button> | ||
</section> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script lang="ts"> | ||
import { audience } from '$lib/store/store.svelte'; | ||
import { InputRadio } from '$lib/ui'; | ||
</script> | ||
|
||
<h1 class="mb-4">Who can see your posts?</h1> | ||
<span class="flex flex-col gap-4"> | ||
<label for="Everyone" class="flex items-center justify-between"> | ||
Everyone | ||
<InputRadio value="Everyone" name="audience" bind:selected={audience.value} /> | ||
</label> | ||
<label for="Only Followers" class="flex items-center justify-between"> | ||
Only Followers | ||
<InputRadio value="Only Followers" name="audience" bind:selected={audience.value} /> | ||
</label> | ||
<label for="No one" class="flex items-center justify-between"> | ||
No one | ||
<InputRadio value="No one" name="audience" bind:selected={audience.value} /> | ||
</label> | ||
</span> |
Uh oh!
There was an error while loading. Please reload this page.