ok so we fixed the button problem i was having, turns out i'm dumb, but we knew that, and i got reactive component loading, good news, not sprucing up the FriendPage, adding more functionality
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { binding_callbacks } from "svelte/internal";
|
import { binding_callbacks } from "svelte/internal"; // WTF is this?
|
||||||
import Button from "../../pieces/Button.svelte";
|
import Button from "../../pieces/Button.svelte";
|
||||||
import DisplayAUser from "../../pieces/DisplayAUser.svelte";
|
import DisplayAUser from "../../pieces/DisplayAUser.svelte";
|
||||||
|
import Tabs from "../../pieces/Tabs.svelte";
|
||||||
|
|
||||||
|
|
||||||
// Ok so i need to test all the paths Cherif has made but a major one doesn't work yet...
|
// Ok so i need to test all the paths Cherif has made but a major one doesn't work yet...
|
||||||
// in the mean time, i need to make some other stuff look nice
|
// in the mean time, i need to make some other stuff look nice
|
||||||
@@ -70,13 +72,13 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
// console.log('got all users ' + allUsers)
|
// console.log('got all users ' + allUsers)
|
||||||
|
|
||||||
|
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
const displayAllUsers = async() => {
|
const displayAllUsers = async() => {
|
||||||
allUsers = await fetch('http://transcendance:8080/api/v2/user/all')
|
allUsers = await fetch('http://transcendance:8080/api/v2/user/all')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
// console.log('got all users ' + allUsers)
|
console.log('got all users ' + allUsers)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -86,10 +88,12 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
// console.log('got all friends ' + allFriends)
|
// console.log('got all friends ' + allFriends)
|
||||||
};
|
};
|
||||||
|
|
||||||
const displayRequestsMade = async() => {
|
// will this work?
|
||||||
|
// const displayRequestsMade = async() => {
|
||||||
|
let displayRequestsMade = async() => {
|
||||||
requestsMade = await fetch('http://transcendance:8080/api/v2/network/pending')
|
requestsMade = await fetch('http://transcendance:8080/api/v2/network/pending')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
// console.log('got requests made ' + requestsMade)
|
console.log('got requests made ' + requestsMade)
|
||||||
};
|
};
|
||||||
|
|
||||||
let sentFriendRequest;
|
let sentFriendRequest;
|
||||||
@@ -118,9 +122,11 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// let sendUsername;
|
|
||||||
const viewAUser = async(aUser) => {
|
const viewAUser = async(aUser) => {
|
||||||
|
console.log('Profile Friend updating userBeingViewed')
|
||||||
userBeingViewed = aUser;
|
userBeingViewed = aUser;
|
||||||
|
|
||||||
|
|
||||||
// sendUsername = userBeingViewed.username;
|
// sendUsername = userBeingViewed.username;
|
||||||
|
|
||||||
// prolly like fetch if you're friends or not?
|
// prolly like fetch if you're friends or not?
|
||||||
@@ -141,6 +147,7 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
<div class="top-grid">
|
<div class="top-grid">
|
||||||
|
|
||||||
<div class="all-users-sidebar">
|
<div class="all-users-sidebar">
|
||||||
|
<!-- <Tabs items={items} {activeItem} on:tabChange={tabChange}/> -->
|
||||||
<h3>All Users</h3>
|
<h3>All Users</h3>
|
||||||
{#if allUsers === undefined}
|
{#if allUsers === undefined}
|
||||||
<div class="error">Failed to load all users</div>
|
<div class="error">Failed to load all users</div>
|
||||||
@@ -160,6 +167,19 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
<div class="status a-user">{aUser.status}</div>
|
<div class="status a-user">{aUser.status}</div>
|
||||||
<br>
|
<br>
|
||||||
{/each}
|
{/each}
|
||||||
|
<Button on:click={displayAllUsers}>Get All Users</Button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<h3>Requests Made</h3>
|
||||||
|
{#if requestsMade === undefined}
|
||||||
|
<div class="error">Failed to load all requests made</div>
|
||||||
|
{:else}
|
||||||
|
{#each requestsMade as request }
|
||||||
|
<div>{request.receiverUsername}</div>
|
||||||
|
<br>
|
||||||
|
{/each}
|
||||||
|
<Button on:click={displayRequestsMade}>Display Requests Made</Button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -172,9 +192,9 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
<!-- use an #await here too? -->
|
<!-- use an #await here too? -->
|
||||||
<!-- you can do better, like an on load sort of thing -->
|
<!-- you can do better, like an on load sort of thing -->
|
||||||
<!-- {#if userBeingViewed !== undefined && userBeingViewed === tmpUserBeingViewed} -->
|
<!-- {#if userBeingViewed !== undefined && userBeingViewed === tmpUserBeingViewed} -->
|
||||||
<!-- {#if userBeingViewed !== undefined} -->
|
<!-- {#if userBeingViewed} -->
|
||||||
{#if userBeingViewed}
|
{#if userBeingViewed !== undefined}
|
||||||
<div>{userBeingViewed.username}</div>
|
<div>{userBeingViewed.username}</div>
|
||||||
<DisplayAUser aUsername={userBeingViewed.username}/>
|
<DisplayAUser aUsername={userBeingViewed.username}/>
|
||||||
<!-- <DisplayAUser aUsername={sendUsername}/> -->
|
<!-- <DisplayAUser aUsername={sendUsername}/> -->
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount, afterUpdate } from 'svelte';
|
||||||
import GenerateUserDisplay from './GenerateUserDisplay.svelte';
|
import GenerateUserDisplay from './GenerateUserDisplay.svelte';
|
||||||
// import {updateGeneratedUser} from './GenerateUserDisplay.svelte';
|
|
||||||
|
|
||||||
export let aUsername;
|
export let aUsername;
|
||||||
let user;
|
let user;
|
||||||
@@ -18,27 +17,23 @@
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// $: {
|
// sadly created an infinite loop
|
||||||
// updateUser(aUsername);
|
// afterUpdate( async() => {
|
||||||
// }
|
// console.log('Display Update aUser username: '+ aUsername)
|
||||||
|
// // http://transcendance:8080/api/v2/user?username=NomDuUserATrouver
|
||||||
|
// user = await fetch(`http://transcendance:8080/api/v2/user?username=${aUsername}`)
|
||||||
|
// .then( (x) => x.json() );
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
|
export const updateUser = async() => {
|
||||||
const updateUser = async(updatedUser) => {
|
console.log('Display Update aUser username: '+ aUsername)
|
||||||
console.log('Display Update aUser username: '+ updateUser)
|
|
||||||
// http://transcendance:8080/api/v2/user?username=NomDuUserATrouver
|
// http://transcendance:8080/api/v2/user?username=NomDuUserATrouver
|
||||||
user = await fetch(`http://transcendance:8080/api/v2/user?username=${updateUser}`)
|
user = await fetch(`http://transcendance:8080/api/v2/user?username=${aUsername}`)
|
||||||
.then( (x) => x.json() );
|
.then( (x) => x.json() );
|
||||||
};
|
};
|
||||||
|
|
||||||
// export const updateUser = async(updatedUser) => {
|
$: aUsername, updateUser();
|
||||||
// console.log('Display Update aUser username: '+ updateUser)
|
|
||||||
// // http://transcendance:8080/api/v2/user?username=NomDuUserATrouver
|
|
||||||
// user = await fetch(`http://transcendance:8080/api/v2/user?username=${updateUser}`)
|
|
||||||
// .then( (x) => x.json() );
|
|
||||||
// updateGeneratedUser(updateUser);
|
|
||||||
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -46,7 +41,7 @@
|
|||||||
|
|
||||||
<!-- OHHHH i could use #await instead of if and have an nice loading page! -->
|
<!-- OHHHH i could use #await instead of if and have an nice loading page! -->
|
||||||
{#if user !== undefined}
|
{#if user !== undefined}
|
||||||
<GenerateUserDisplay bind:user={user} primary={true}/>
|
<GenerateUserDisplay user={user} primary={true}/>
|
||||||
<!-- <GenerateUserDisplay user={user} primary={true}/> -->
|
<!-- <GenerateUserDisplay user={user} primary={true}/> -->
|
||||||
{:else}
|
{:else}
|
||||||
<h2>Sorry</h2>
|
<h2>Sorry</h2>
|
||||||
|
|||||||
@@ -24,9 +24,6 @@
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// export function updateGeneratedUser(updatedUser) {
|
|
||||||
// user = updatedUser;
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
if (user.loseGame > user.winGame) {
|
if (user.loseGame > user.winGame) {
|
||||||
|
|||||||
Reference in New Issue
Block a user