Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Bump to 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
StamTsag committed Jan 28, 2023
1 parent a59800d commit 5562353
Show file tree
Hide file tree
Showing 39 changed files with 356 additions and 301 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fronvo-desktop",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"description": "The desktop app of the free-convo chat app.",
"main": "src/electron.cjs",
Expand Down
6 changes: 5 additions & 1 deletion src/interfaces/account/fetchHomePosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

import type { FronvoError, HomePost } from 'interfaces/all';

export interface FetchHomePostsParams {}
export interface FetchHomePostsParams {
from: string;
to: string;
}

export interface FetchHomePostsResult extends FronvoError {
totalPosts: number;
homePosts: HomePost[];
}
18 changes: 16 additions & 2 deletions src/interfaces/c2s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import type {
FetchCommunityMessagesParams,
FetchCommunityMessagesResult,
} from './account/fetchCommunityMessages';
import type { FetchHomePostsResult } from './account/fetchHomePosts';
import type {
FetchHomePostsParams,
FetchHomePostsResult,
} from './account/fetchHomePosts';
import type {
FetchProfileDataParams,
FetchProfileDataResult,
Expand Down Expand Up @@ -104,6 +107,10 @@ import type {
RejectJoinRequestParams,
RejectJoinRequestResult,
} from './account/rejectJoinRequest';
import type {
FetchHomePostsGuestParams,
FetchHomePostsGuestResult,
} from './noAccount/fetchHomePostsGuest';

export interface ClientToServerEvents {
register: (
Expand Down Expand Up @@ -167,7 +174,10 @@ export interface ClientToServerEvents {
{}: FindProfilesParams,
callback?: ({}: FindProfilesResult) => void
) => void;
fetchHomePosts: (callback?: ({}: FetchHomePostsResult) => void) => void;
fetchHomePosts: (
{}: FetchHomePostsParams,
callback?: ({}: FetchHomePostsResult) => void
) => void;
createCommunity: (
{}: CreateCommunityParams,
callback?: ({}: CreateCommunityResult) => void
Expand Down Expand Up @@ -218,4 +228,8 @@ export interface ClientToServerEvents {
{}: RejectJoinRequestParams,
callback?: ({}: RejectJoinRequestResult) => void
) => void;
fetchHomePostsGuest: (
{}: FetchHomePostsGuestParams,
callback?: ({}: FetchHomePostsGuestResult) => void
) => void;
}
15 changes: 15 additions & 0 deletions src/interfaces/noAccount/fetchHomePostsGuest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// ******************** //
// Interfaces for the fetchHomePostsGuest event file.
// ******************** //

import type { FronvoError, HomePost } from 'interfaces/all';

export interface FetchHomePostsGuestParams {
from: string;
to: string;
}

export interface FetchHomePostsGuestResult extends FronvoError {
totalPosts: number;
homePosts: HomePost[];
}
5 changes: 0 additions & 5 deletions src/lib/app/account/Account.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { goto } from '$app/navigation';
import Login from '$lib/app/account/Login.svelte';
import Register from '$lib/app/account/Register.svelte';
import RegisterVerify from '$lib/app/account/RegisterVerify.svelte';
Expand All @@ -17,10 +16,6 @@
import ResetPassword from './ResetPassword.svelte';
import ResetPasswordFinal from './ResetPasswordFinal.svelte';
import ResetPasswordVerify from './ResetPasswordVerify.svelte';
goto('/login', {
replaceState: true,
});
</script>

<Center>
Expand Down
13 changes: 5 additions & 8 deletions src/lib/app/account/Login.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
accountRegisterTab,
accountResetPasswordTab,
} from 'stores/account';
import { tokenInvalid } from 'stores/all';
import { loginSucceeded } from 'stores/main';
import { socket } from 'stores/all';
import { onMount, onDestroy } from 'svelte';
import { fade, scale } from 'svelte/transition';
import { setKey } from 'utilities/global';
import { goto } from '$app/navigation';
import { dismissModal } from 'utilities/main';
import { homePosts } from 'stores/home';
let email: string;
let password: string;
Expand All @@ -38,10 +38,6 @@
}
onMount(() => {
goto('/login', {
replaceState: true,
});
emailInput = document.getElementById('email-input') as HTMLInputElement;
passwordInput = document.getElementById(
'password-input'
Expand Down Expand Up @@ -80,9 +76,10 @@
toggleUI(true);
} else {
setKey('token', token);
// Incase it occured before
$tokenInvalid = false;
$homePosts = undefined;
$loginSucceeded = true;
dismissModal();
}
});
}
Expand Down
5 changes: 0 additions & 5 deletions src/lib/app/account/Register.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { goto } from '$app/navigation';
import type { FronvoError } from 'interfaces/all';
import {
accountPanelAnimDuration,
Expand Down Expand Up @@ -35,10 +34,6 @@
}
onMount(() => {
goto('/register', {
replaceState: true,
});
emailInput = document.getElementById('email-input') as HTMLInputElement;
passwordInput = document.getElementById(
'password-input'
Expand Down
4 changes: 0 additions & 4 deletions src/lib/app/account/ResetPassword.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
}
onMount(() => {
goto('/reset', {
replaceState: true,
});
emailInput = document.getElementById('email-input') as HTMLInputElement;
resetButton = document.getElementById(
'reset-button'
Expand Down
44 changes: 21 additions & 23 deletions src/lib/app/main/Main.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import MainSideNav from '$lib/app/main/MainSideNav.svelte';
import Modal from '$lib/app/main/Modal.svelte';
import { currentPanelId, loginSucceeded, panels } from 'stores/main';
import { currentPanelId, panels } from 'stores/main';
import { onMount } from 'svelte';
import { getKey } from 'utilities/global';
import Dropdown from './Dropdown.svelte';
Expand All @@ -19,34 +19,32 @@
});
</script>

{#if $loginSucceeded}
{#if $xmasMode}
<svelte:component
this={ParticlesComponent}
id="tsparticles"
options={$xmasParticleOptions}
/>
{/if}
{#if $xmasMode}
<svelte:component
this={ParticlesComponent}
id="tsparticles"
options={$xmasParticleOptions}
/>
{/if}

<!-- Loading indicator -->
<ProgressBar />
<!-- Loading indicator -->
<ProgressBar />

<!-- Smoothity-smooth modal auto-switching -->
<Modal />
<!-- Smoothity-smooth modal auto-switching -->
<Modal />

<!-- Smoothity-smooth dropdown auto-switching -->
<Dropdown />
<!-- Smoothity-smooth dropdown auto-switching -->
<Dropdown />

<div class="main-container">
<!-- Side nav which transforms into a Top nav on mobile -->
<MainSideNav />
<div class="main-container">
<!-- Side nav which transforms into a Top nav on mobile -->
<MainSideNav />

<div id="content">
<!-- Reactive panel switching -->
<svelte:component this={panels[$currentPanelId]} />
</div>
<div id="content">
<!-- Reactive panel switching -->
<svelte:component this={panels[$currentPanelId]} />
</div>
{/if}
</div>

<style>
.main-container {
Expand Down
39 changes: 35 additions & 4 deletions src/lib/app/main/MainSideNav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
import { fly } from 'svelte/transition';
import { showModal, switchPanel } from 'utilities/main';
import { ModalTypes, PanelTypes } from 'types/main';
import { currentPanelId } from 'stores/main';
import { currentPanelId, loginSucceeded } from 'stores/main';
import { ourProfileData, targetProfile, userData } from 'stores/profile';
import { loadProfilePanel } from 'utilities/profile';
import { goto } from '$app/navigation';
async function decideProfileAction(): Promise<void> {
if (!$loginSucceeded) {
showModal(ModalTypes.JoinFronvo);
return;
}
if (
$currentPanelId == PanelTypes.Profile &&
$userData.profileId != $ourProfileData.profileId
Expand All @@ -23,10 +29,35 @@
switchPanel(PanelTypes.Profile);
}
}
function loadPanel(panel: PanelTypes): void {
if ($loginSucceeded) {
switchPanel(panel);
} else {
showModal(ModalTypes.JoinFronvo);
}
}
function loadModal(modal: ModalTypes): void {
if ($loginSucceeded) {
showModal(modal);
} else {
showModal(ModalTypes.JoinFronvo);
}
}
</script>

<div id="blur" in:fly={{ x: -100, duration: 1000 }} class="side-nav-container">
<div id="component" on:click={() => switchPanel(PanelTypes.Home)}>
<div
id="component"
on:click={() => {
goto('/home', {
replaceState: true,
});

switchPanel(PanelTypes.Home);
}}
>
<Home />
<h1>Home</h1>
</div>
Expand All @@ -36,12 +67,12 @@
<h1>Profile</h1>
</div>

<div id="component" on:click={() => switchPanel(PanelTypes.Communities)}>
<div id="component" on:click={() => loadPanel(PanelTypes.Communities)}>
<Communities />
<h1>Community</h1>
</div>

<div id="component" on:click={() => showModal(ModalTypes.FindProfiles)}>
<div id="component" on:click={() => loadModal(ModalTypes.FindProfiles)}>
<Search />
<h1>Search</h1>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/lib/app/main/modals/CreatePostModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { fade } from 'svelte/transition';
import type { ModalData } from 'types/main';
import { dismissModal, setProgressBar } from 'utilities/main';
import { loadProfilePanel } from 'utilities/profile';
import ModalTemplate from '../ModalTemplate.svelte';
let title: string;
Expand Down Expand Up @@ -49,7 +48,7 @@
to: ($userPosts.length + 1).toString(),
},
({ profilePosts }) => {
$userPosts = profilePosts.reverse();
$userPosts = profilePosts;
$userData.totalPosts += 1;
dismissModal();
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/app/main/modals/DeletePostModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
if (!err) {
dismissModal(() => {
$userPosts.splice($postModalIndex, 1);
$userPosts = $userPosts;
$userData.totalPosts -= 1;
});
Expand Down
5 changes: 5 additions & 0 deletions src/lib/app/main/modals/JoinFronvoModal.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
import Account from '$lib/app/account/Account.svelte';
</script>

<Account />
3 changes: 2 additions & 1 deletion src/lib/app/main/modals/PostModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { dismissModal } from 'utilities/main';
import {
currentPanelId,
loginSucceeded,
postModalForHome,
postModalInfo,
} from 'stores/main';
Expand Down Expand Up @@ -58,7 +59,7 @@
titleListener: () => loadProfilePanel(getUserData().profileId),
titleListenerCondition: () => {
// Only visit if not in profile panel, profile posts ARE IN THE SAME PROFILE
return $currentPanelId != PanelTypes.Profile;
return $loginSucceeded && $currentPanelId != PanelTypes.Profile;
},
title: '',
titleDropdown: DropdownTypes.PostOptions,
Expand Down
Loading

0 comments on commit 5562353

Please sign in to comment.