-
Notifications
You must be signed in to change notification settings - Fork 8
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
Print files owned by current user to console #347
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks for starting this, Kevin. I left a few quick comments, but there are bigger designs issue that we need to address:
-
We shouldn't list just any documents that the user's owns: what if they're supposed to be private? We should implement Published flag for documents #291 first and then only list documents that have been marked as published. Sub has emphasized this and n-dim had a similar approach, which I think we should follow.
-
The user profile editable by a logged-in user should be a separate page from the public display of a profile visible to anyone. This will also avoid that weird stuff with refs.
<UserProfileForm /> | ||
<UserProfileForm onRefsLoaded={setMyRefs} /> | ||
<div style="margin-top: 1rem;"> | ||
<h3 |
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 inline styles. Use the external stylesheet.
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.
Should/can we lint directly for the keyword style
, then, if we're not allowing even one-liners?
"0 2px 8px rgba(0,0,0,0.1)"; | ||
}} | ||
onMouseOut={(e) => { | ||
e.currentTarget.style.boxShadow = "none"; |
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.
Ditto about inline styles, and also you shouldn't use mouse over events to change styles. Use the appropriate CSS selectors.
{items.map(([id, title]: [string, string]) => ( | ||
<Fragment key={id}> | ||
<a | ||
href={`${import.meta.env.VITE_SERVER_URL}/model/${id}`} |
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.
Shouldn't need this env variable. Use Solid Router's A
component.
/** Page to configure user profile. */ | ||
export default function UserProfilePage() { | ||
const [myRefs, setMyRefs] = createSignal<[string, string][] | null>(null); |
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.
Having to pass these refs around is a code smell. Also, I don't understand the types. This isn't how you usually create a ref.
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.
The refs are going to be a list of [string,string]
s giving a document's ref and name. Is the problem that it's already been stringified rather than passing around actual document objects, or something like that?
Thanks @epatters. I agree that there should be a public user page that shows only public docs. Maybe the page where you can edit your profile can be a "private" profile page where you can also see your private owned docs? |
packages/backend/pkg/src/index.ts
Outdated
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.
I think RpcResult<Array<[string, string]>>>
is probably wrong here and reflects the weird front-end types you couldn't parse earlier.
const api = useApi(); | ||
const params = useParams(); | ||
|
||
const [userModels, setUserModels] = createSignal<[string, string][]>(); //QQQ: unclear what type the RPC call should return to; Documents? |
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.
See first comment for the Rust side of this question.
OK, I think I was able to sensibilize the work so far pretty easily. But there are some todos:
|
This PR adds a route
/user/:username
accessing a public profile page for userusername
which lists their documents. Currently it simply lists all owned models but the intended design is that it lists all public documents of any class. The display is currently just of hyperlinked titles; the intent is to include more metadata.