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

Resources Management UX Merge #5

Merged
merged 0 commits into from
Sep 20, 2024
Merged

Conversation

jtucholski
Copy link

Description of the change

This PR largely focuses on changes to the Resources Management page. There are a lot of areas where the code can be refactored after which would extend into creation of new components & types.

Screenshot(s)

image
image

Copy link

@calisio calisio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments on this PR, some of which might be addressed in a later ticket (they are marked with a 💡). Some are small changes, some are things to consider, some are just suggestions. Feel free to push back on any of it. Also, comments might be out of order in the main feed-- I was jumping around in the files so it might be a bit of back and forth.

Lastly, I noticed a small bug having to do with drag and drop, which is a larger discussion since we may consider implementing a library later to make it easier. I've attached a video to show the issue.

Screen.Recording.2024-09-17.at.4.32.16.PM.mov

It seems like you can drag links into the left hand side and it creates a div for it there. Not sure what the best fix is for this.

Comment on lines 11 to 18
<StaticContentCard
title="Kolibri"
description="Kolibri provides an extensive library of educational content suitable for all learning levels."
imgSrc={KolibriImg}
altText="Kolibri logo"
linkUrl="https://kolibri.v2.unlockedlabs.xyz/oidcauthenticate/"
linkText="Explore Kolibri's Content"
/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of passing this info in like this, the idea was that we would call the backend to render all of these that are stored in the backend - i think the right call is a GET to /api/open-content but I would double check on that. Hard coding was just a temporary solution for the demo, but now that we've updated this might as well do it completely.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, rather than passing in each individual component, it might just be easier to pass in the whole open content provider (as in pass in the whole object that is returned, such as Kolibri, which contains the following fields since it is of type OpenContentProvider:

type OpenContentProvider struct {
	DatabaseFields
	Url                string            `gorm:"size:255;not null;unique" json:"url"`
	ProviderPlatformID uint              `json:"provider_platform_id"`
	Thumbnail          string            `json:"thumbnail_url"`
	CurrentlyEnabled   bool              `json:"currently_enabled"`
	Description        string            `json:"description"`
	ProviderPlatform   *ProviderPlatform `gorm:"foreignKey:ProviderPlatformID;constraint:OnDelete SET NULL" json:"-"`
}

and then you would access each of these in the StaticContentCard.tsx. See comment on this file for more reference.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you but would ask if we can consider it out of scope for this task. I don't see Content Provider types defined in the frontend or backend seed data for Open Content Providers. Do you?

Copy link

@calisio calisio Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I see what you are saying. But, I will say that I don't think that updating this StaticContent card is in the scope of this task either. I suggested this change because it feels like if we are going to create a new component, we should probably update and fix it completely. I'm okay with creating a different task for this, but in the future maybe a new task should be made to handle the entire issue? I might be missing something regarding why this was updated in this ticket, though, so please let me know if so!

frontend/src/Components/ExternalLink.tsx Outdated Show resolved Hide resolved
frontend/src/Components/ResourcesCategoryCard.tsx Outdated Show resolved Hide resolved
Comment on lines 3 to 19
interface StaticContentCardProps {
title: string;
description: string;
imgSrc: string;
altText: string;
linkUrl: string;
linkText: string;
}

export default function StaticContentCard({
title,
description,
imgSrc,
altText,
linkUrl,
linkText
}: StaticContentCardProps) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So by passing in an object of type OpenContentProvider, we could eliminate all of these lines of code. It would be reduced down to just export default function StaticContentCard({provider}: {provider: OpenContentProvider}) { .. rest of code ....}. Also, I would say that StaticContentCard might not be the best thing to name this component. Because this card will only be used for Open Content providers, I would name it as such. That's just how I would approach it though- not sure if there was some other motive behind the naming of this component.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When writing this I didn't realize that there was some dynamic nature to our content providers. I'd say see my previous comment again and maybe a future task can be to remove static providers and replace it with dynamic calls to the API to get Open Content Providers?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya gotcha, we can do that 👍

return (
<div className="card card-compact bg-base-teal overflow-hidden">
<img
src={imgSrc}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so then down here, you would access the info by doing provider.imgSrc. Again, this is how I would approach it but feel free to push back!

frontend/tailwind.config.js Outdated Show resolved Hide resolved
frontend/src/Pages/ResourcesManagement.tsx Outdated Show resolved Hide resolved
frontend/src/Pages/ResourcesManagement.tsx Outdated Show resolved Hide resolved
Comment on lines 553 to 583
<div className="card-body gap-2">
<div className="flex justify-between">
<h3 className="card-title text-sm">{collection.name}</h3>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 card-body and card-title are built into daisyUI and don't fit our styling. the styling tags we can use are listed in app.css. Its a bit confusing because we use daisyUI in some places, but our own styled components in other places, but I am trying to shift away from using daisyUI and more towards building our own components/styling so we have complete control over everything we create. Daisy is super complicated to alter their base styles, so when in doubt look at the app.css file or do it inline (if it is not a universal style that will be used other places). For this, the <h3> should already have the necessary styling, so you can remove the whole className="card-title text-sm". the div that hascard-body can be removed completely, and instead we can just add py-4 px-6 to the div that has className="card" (it might be worth looking into the padding for card components in general and making this a universal padding used. but, we need to make sure it wont impact the other layouts that use card and evaluate from there).

frontend/src/Pages/ResourcesManagement.tsx Outdated Show resolved Hide resolved
@jtucholski
Copy link
Author

@calisio With respect to the bug you observed I think we need to restrict what types of elements can be dropped onto a drag/drop container. We could look into fixing that here or we might want to make that part of the ticket that goes with replacing the functionality with a drag and drop library.

What do you think?

@calisio
Copy link

calisio commented Sep 19, 2024

Honestly, ya I think that we should just leave it for now and fix it when we add a drag drop library. If bug isn't breaking the functionality maybe we just leave it for later?
I did find a different bug when testing to make sure that saving collections worked as expected. I attached a video below.
Screen Recording 2024-09-19 at 11.58.43 AM.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants