-
Notifications
You must be signed in to change notification settings - Fork 31
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
website: UI updates in relation to backend changes #2304
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,12 @@ import { format, isSameMonth, parse } from 'date-fns'; | |
import Image from 'next/image'; | ||
import { useRouter } from 'next/navigation'; | ||
import { useEffect, useState } from 'react'; | ||
import { FiCalendar, FiClock } from 'react-icons/fi'; | ||
import { | ||
FiCalendar, | ||
FiClock, | ||
FiDownload, | ||
FiExternalLink, | ||
} from 'react-icons/fi'; | ||
|
||
import { Accordion, CustomButton } from '@/components/ui'; | ||
import { getEventDetails } from '@/services/apiService'; | ||
|
@@ -338,33 +343,34 @@ const SingleEvent: React.FC<any> = ({ id }) => { | |
{event.resources.map((resource: any) => ( | ||
<div | ||
key={resource.id} | ||
className="p-4 bg-white rounded-lg shadow hover:shadow-md transition-shadow duration-300 flex justify-between items-center" | ||
className="flex justify-between items-center p-4 bg-gray-50 rounded-lg shadow-md hover:shadow-lg transition-shadow duration-200" | ||
> | ||
<div> | ||
<h3 className="text-lg font-medium">{resource.title}</h3> | ||
{resource.link && ( | ||
<a | ||
href={resource.link} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="text-blue-500 hover:underline" | ||
> | ||
View Link | ||
</a> | ||
)} | ||
{resource.resource && ( | ||
<a | ||
href={resource.resource} | ||
download | ||
className="text-blue-500 hover:underline ml-4" | ||
> | ||
Download | ||
</a> | ||
)} | ||
<h3 className="text-xl font-semibold mb-2 text-gray-800"> | ||
{resource.title} | ||
</h3> | ||
<div className="flex space-x-4"> | ||
{resource.link && ( | ||
<a | ||
href={resource.link} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="inline-flex items-center text-blue-600 hover:underline font-medium" | ||
> | ||
<FiExternalLink className="mr-2" /> View Link | ||
</a> | ||
)} | ||
{resource.resource_url && ( | ||
<a | ||
href={resource.resource_url} | ||
download | ||
className="inline-flex items-center text-blue-600 hover:underline font-medium" | ||
> | ||
<FiDownload className="mr-2" /> Download | ||
</a> | ||
)} | ||
</div> | ||
Comment on lines
+346
to
+372
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider enhancing security for external links and downloads While the UI improvements look great, there are some security considerations:
Apply this diff to enhance security: - target="_blank"
- rel="noopener noreferrer"
+ target="_blank"
+ rel="noopener noreferrer nofollow"
+ className="inline-flex items-center text-blue-600 hover:underline font-medium" - download
+ download
+ onClick={(e) => {
+ const fileExtension = resource.resource_url.split('.').pop()?.toLowerCase();
+ const allowedTypes = ['pdf', 'doc', 'docx', 'xls', 'xlsx'];
+ if (!allowedTypes.includes(fileExtension)) {
+ e.preventDefault();
+ alert('Invalid file type');
+ }
+ }}
|
||
</div> | ||
<span className="text-sm text-gray-500"> | ||
Order: {resource.order} | ||
</span> | ||
</div> | ||
))} | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🛠️ Refactor suggestion
Specify the exact data type instead of using 'any'
Using
any
reduces the benefits of TypeScript's type safety. Replacing it with the actual data type ofdata
will enhance reliability and maintainability.