-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Assitants] Community | User tabs #773
Conversation
@@ -34,5 +43,7 @@ export const load = async ({ url }) => { | |||
assistants: JSON.parse(JSON.stringify(assistants)) as Array<Assistant>, | |||
numTotalItems, | |||
numItemsPerPage: NUM_PER_PAGE, | |||
createdByUser: createdByName, | |||
createdByMe: createdByName === (locals.user?.username ?? locals.user?.name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this I think, just compare the requested username with the current username in the page directly to see it's the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handled in 6913adc
src/routes/assistants/+page.svelte
Outdated
@@ -13,6 +14,7 @@ | |||
import Pagination from "$lib/components/Pagination.svelte"; | |||
|
|||
export let data: PageData; | |||
export let user: LayoutData["user"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user is already in Pagedata (data.user)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handled in f978c9d
src/routes/assistants/+page.svelte
Outdated
@@ -90,6 +122,32 @@ | |||
<CarbonAdd />Create New assistant | |||
</a> | |||
</div> | |||
{#if user?.username} | |||
<div class="mt-10 flex gap-x-2"> | |||
{#if data.createdByUser && !data.createdByMe} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this instead? createdByUser === data.user.username
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handled in 6913adc
6dad2a6
to
bca0292
Compare
Updated behaviour.for the info, I'm logged in as user "mishig" Screen.Recording.2024-02-05.at.11.11.10.AM.movnote: when I open "?user=victor". This is what I see. Once I click to "My assistants", "Victor's assissntas" are gone & turns into "Community" Screen.Recording.2024-02-05.at.11.11.44.AM.mov |
|
||
// fetch the top assistants sorted by user count from biggest to smallest, filter out all assistants with only 1 users. filter by model too if modelId is provided | ||
const filter: Filter<Assistant> = { | ||
userCount: { $gt: 1 }, | ||
modelId: modelId ?? { $exists: true }, | ||
featured: true, | ||
createdByName: createdByName ?? undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's doesn't seems to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this specific filter ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Victor Muštar <victor.mustar@gmail.com>
This reverts commit fc8a2fc.
13dfcc3
to
02ac4da
Compare
src/routes/assistants/+page.svelte
Outdated
@@ -25,6 +27,19 @@ | |||
} | |||
goto(newUrl); | |||
}; | |||
|
|||
function getHref(keysAdd: { key: string; val: string }[], keysDelete?: string[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: should take the url as argument like in 8cd7b98
(not for myself. in subseq PR, I should refactor getHref
as a utility function that can be used in different components)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this pr is taking long time, maybe we can just cherry-pick & merge 9a21527 to main ? |
What's the blocker for the PR? 👀 |
I've updated it a bit, it should be ready now. |
Right now when you are on some user's or your assistant (i.e. the url has |
5ca2a8f
to
b7ede7f
Compare
Updates:
|
Please let me know if there's anything else |
@@ -0,0 +1,41 @@ | |||
export function getHref( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO easier to understand like this:
/**
* Util to edit a URL's search params
*
* Returns the new URL
*/
export function editSearchParams(
url: URL | string,
modifications: {
/** New search params added */
add?: Record<string, string | undefined | null>;
/** Remove search params */
remove?: string[];
/** Remove all existing search params except those */
keepOnly?: string[];
}
): string {
* [Assistants] Add pagination * [Assitants] Community | User tabs * format * minimize diff * Update src/routes/assistants/+page.svelte Co-authored-by: Victor Muštar <victor.mustar@gmail.com> * use data.user * rm unused import * Use a href & simplify overall * lint * it will never be a button * statements need to be reactive * format * set filter differntly * Revert "set filter differntly" This reverts commit fc8a2fc. * use inline * avoid ugly image change * fix query * ui update * update link to profiles * link to HF profile * dark mode * Update +page.svelte * refactor getHref to be more descriptive * Preserve `user` searchQuery when chaning model ids * `getHref` utility * dont show single "Community" btn for non-logged in users * fix iterator --------- Co-authored-by: Victor Muštar <victor.mustar@gmail.com>
Have a tab/picker between "community" or "my" assistants
Scenario 1: I'm not logged in
Scenario 2: I'm logged in as "mishig" & I go to "?assistants"
Scenario 3: I'm logged in as "mishig" & I go to "?assistants?user=victor"
Scenario 4: I'm logged in as "mishig" & I go to "?assistants?user=mishig"