Skip to content
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

chore(layout): clean up code and improve event handling in layout components #851

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare global {
// interface Platform {}
}
}

declare const __COMMIT_HASH__: string

export {}
9 changes: 9 additions & 0 deletions src/custom-events.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// custom-events.d.ts
declare namespace svelteHTML {
interface HTMLAttributes<T> {
"on:swipeleft"?: (event: CustomEvent) => void
"on:swiperight"?: (event: CustomEvent) => void
"on:swipeup"?: (event: CustomEvent) => void
"on:swipedown"?: (event: CustomEvent) => void
}
}
1 change: 0 additions & 1 deletion src/lib/layouts/Chatbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
export let replyTo: MessageType | undefined = undefined
export let emojiClickHook: (emoji: string) => boolean
export let activeChat: Chat
export const typing: User[] = []

const dispatch = createEventDispatcher()

Expand Down
2 changes: 1 addition & 1 deletion src/lib/wasm/IWarp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const inititialized: Writable<boolean> = writable(false)

export async function initWarp() {
if (!get(inititialized)) {
await init()
await init({})
inititialized.set(true)
}
}
8 changes: 4 additions & 4 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import Market from "$lib/components/market/Market.svelte"
import { swipe } from "$lib/components/ui/Swipe"

log.debug("Initializing app, layout routes page.")

TimeAgo.addDefaultLocale(en)
let keybinds: Keybind[]
let devmode: boolean = get(SettingsStore.state).devmode
Expand Down Expand Up @@ -229,8 +231,6 @@
Store.state.devices.muted.subscribe(state => (muted = state))
Store.state.devices.deafened.subscribe(state => (deafened = state))

console.log("Arriving here on +layout")

window.addEventListener(
"click",
() => {
Expand Down Expand Up @@ -275,10 +275,10 @@
<div
id="app"
use:swipe
on:swipeleft={_ => {
on:swipeleft={() => {
UIStore.closeSidebar()
}}
on:swiperight={_ => {
on:swiperight={() => {
UIStore.openSidebar()
}}>
{@html `<style>${style}</style>`}
Expand Down
1 change: 0 additions & 1 deletion src/routes/chat/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,6 @@
<Chatbar
replyTo={replyTo}
activeChat={$activeChat}
typing={$activeChat.typing_indicator.users && $activeChat.typing_indicator.users().map(u => $users[u])}
emojiClickHook={emoji => {
if (reactingTo) {
reactTo(reactingTo, emoji, true)
Expand Down