-
Notifications
You must be signed in to change notification settings - Fork 4
feat: 실험실(Labs) 기능 추가 - 서버시계 및 QR 생성기 #59
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
Conversation
…me synchronization
…mplates correctly
Deploying linku with
|
| Latest commit: |
7162451
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://39870998.linku-6s6.pages.dev |
| Branch Preview URL: | https://feat-template.linku-6s6.pages.dev |
Summary of ChangesHello @Turtle-Hwan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the application by introducing a new 'Labs' section, which includes two valuable utilities: a QR code generator and a server clock. The QR code generator offers flexible options for creating scannable codes with custom branding, while the server clock provides critical timing information for external services. Additionally, a subtle but important refinement to the template synchronization mechanism ensures more reliable data handling for user-created and cloned templates. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a new "Labs" section with two experimental features: a QR Code Generator and a Server Clock. It includes new components for these features, along with necessary dependency updates in package.json and pnpm-lock.yaml. Additionally, a minor but important logic improvement was made in src/apis/templates.ts to correctly handle template syncing based on their syncStatus and cloned properties, ensuring that templates not explicitly synced or those that are cloned are always created as new entries on the server. The new components are well-structured and demonstrate good practices for state management, UI interaction, and network requests.
| // Templates not synced with server (syncStatus undefined or 'local') should use POST | ||
| // Cloned templates should also create a new template (to get a new ID) | ||
| const shouldCreateNew = template.syncStatus === 'local' || template.cloned === true; | ||
| const shouldCreateNew = template.syncStatus !== 'synced' || template.cloned === true; |
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 change from template.syncStatus === 'local' to template.syncStatus !== 'synced' is a good improvement. It makes the logic more robust by ensuring that any template not explicitly marked as 'synced' (including undefined or other statuses) will be treated as a new creation, which is safer and more aligned with the intent of creating new entries for local or cloned templates.
| } catch { | ||
| console.warn("로고 로드 실패, 로고 없이 생성"); | ||
| } |
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.
| refresh: () => Promise<void>; | ||
| } | ||
|
|
||
| const SYNC_INTERVAL = 1000; // 1초마다 재동기화 |
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.
A SYNC_INTERVAL of 1000ms (1 second) for re-syncing the server time offset might be quite aggressive. While requestAnimationFrame handles the visual update, frequent network requests (even HEAD requests) can consume resources and potentially hit rate limits on some servers. Consider increasing this interval to something like 5-10 seconds to reduce network overhead, as the offset doesn't typically change rapidly enough to warrant 1-second updates.
Summary
Changes
src/components/LabsDialog.tsx- 실험실 다이얼로그src/components/Labs/ServerClockSection.tsx- 서버시계 UIsrc/components/Labs/useServerTime.ts- 서버 시간 동기화 Hooksrc/components/Labs/QRGeneratorSection.tsx- QR 생성기 UIsrc/components/MainLayout.tsx- 헤더에 실험실 아이콘 추가src/apis/templates.ts- 템플릿 동기화 조건 수정Test plan