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

Add sessions to sidebar and show filter and export options #215

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

odkhang
Copy link
Collaborator

@odkhang odkhang commented Aug 8, 2024

This PR closes/references issue #190 .

How has this been tested?

Checklist

  • I have added tests to cover my changes.

Summary by Sourcery

Add a new 'Sessions' section to the sidebar with filtering and export options, including a custom dropdown for export formats and QR code generation for certain formats. Enhance the schedule view and update the router to support the new section.

New Features:

  • Added a new 'Sessions' section to the sidebar with filter and export options.
  • Implemented export functionality for sessions in various formats (ICS, JSON, XCal, XML) including options for exporting starred sessions.
  • Introduced a custom dropdown component for selecting export options with QR code generation for certain formats.

Enhancements:

  • Enhanced the schedule view to include a filter button and an export dropdown for better user interaction.
  • Updated the router to include a new route for the 'Sessions' section.

Documentation:

  • Added translations for the new 'Sessions' label in multiple languages.

Tests:

  • Added tests to cover the new export functionality and session filtering.

Copy link

sourcery-ai bot commented Aug 8, 2024

Reviewer's Guide by Sourcery

This pull request enhances the user interface by adding sessions to the sidebar and providing filter and export options. The changes include the addition of a new sessions view, export functionality, and corresponding backend support. Translations for the new 'Sessions' label have been added in multiple languages.

File-Level Changes

Files Changes
webapp/src/locales/ar.json
webapp/src/locales/de.json
webapp/src/locales/en.json
webapp/src/locales/es.json
webapp/src/locales/fr.json
webapp/src/locales/pt_BR.json
webapp/src/locales/ru.json
webapp/src/locales/uk.json
Added translations for 'Sessions' label in multiple languages.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

@odkhang
Copy link
Collaborator Author

odkhang commented Aug 8, 2024

new page sessions with filter and export

image

export is added for schedule as well

image

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @odkhang - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider optimizing QR code generation to improve performance, possibly by generating on-demand or implementing caching.
  • The export functionality is duplicated in both schedule and sessions views. Consider extracting this into a shared component or mixin to reduce code duplication.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -112,6 +165,34 @@ export default {
} else {
this.$store.dispatch('schedule/filter', {type: 'fav'})
}
},
async makeExport() {
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider refactoring the makeExport function for better separation of concerns and error handling.

The makeExport function is handling both API calls and file downloads. Consider separating these concerns for better maintainability. Improve error handling to provide better user feedback instead of just logging to console. Use let or const instead of var for variable declarations. Consider using a dedicated service for API calls to keep component logic cleaner.

		async makeExport() {
			try {
				this.isExporting = true;
				const exportData = await this.fetchExportData();
				await this.downloadExportFile(exportData);
			} catch (error) {
				this.handleExportError(error);
			} finally {
				this.isExporting = false;
			}
		},

@@ -165,6 +166,33 @@ def get_uid_from_token(request, world_id):
return token_decode.get("uid")


class ExportView(APIView):
Copy link

Choose a reason for hiding this comment

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

🚨 issue (security): Enhance security and error handling in ExportView.

The ExportView lacks authentication, which could be a security risk. Implement proper authentication checks. Use Django's URL reverse function for safer and more maintainable URL construction. Improve error handling to properly communicate failures back to the client.

@@ -0,0 +1,161 @@
<template>
Copy link

Choose a reason for hiding this comment

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

suggestion (performance): Optimize QR code generation and improve component structure.

Consider moving QR code generation to the server for better performance and reduced client-side bundle size. Clarify the usage of the outsideClick method, ensuring proper addition and removal of event listeners. Scope the CSS styles to avoid potential conflicts with other components. Consider using a Vue-specific QR code library for better optimization.

<template>
  <div class="export-select">
    <ServerSideQRCode v-if="showQRCode" :data="scheduleData" />
    <button @click="toggleQRCode">Toggle QR Code</button>

@mariobehling mariobehling merged commit e329d2c into fossasia:development Aug 8, 2024
1 of 7 checks passed
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.

2 participants