refactor: clean code phase 2 — file splits and DRY fixes#116
Merged
alexneamtu merged 21 commits intomainfrom Mar 10, 2026
Merged
refactor: clean code phase 2 — file splits and DRY fixes#116alexneamtu merged 21 commits intomainfrom
alexneamtu merged 21 commits intomainfrom
Conversation
Add RetentionDays validator to the validate package and remove the duplicate inline validRetentionDays map from organization.go. Also add Password validator and corresponding tests in preparation for deduplicating the three password validation blocks in auth.go.
Replace the three duplicate password length checks in auth.go (Register, ResetPassword, UpdateUser) with validate.Password calls, and replace the inline validRetentionDays map with validate.RetentionDays.
Creates web/src/types/video.ts with canonical Video, VideoTag, Folder, and Tag interfaces. Removes duplicate inline declarations from VideoDetail.tsx and Library.tsx. VideoDetail-only fields (document, documentStatus, transcriptionLanguage, noiseReduction, playlists) are marked optional so Library can safely use the same type without carrying unused fields.
…rd to shared utils Creates web/src/utils/format.ts with formatDuration, formatDate, formatChartDate, and expiryLabel, and web/src/utils/clipboard.ts with copyToClipboard. Removes all inline duplicate definitions from VideoDetail.tsx, Library.tsx, PlaylistDetail.tsx, Playlists.tsx, Analytics.tsx, Recorder.tsx, and CameraRecorder.tsx, replacing them with imports from the new shared modules.
Extract SharingSection, TranscriptSection, and CommentsSection from the 2088-line VideoDetail.tsx into a VideoDetail/ directory with an index.tsx orchestrator and three focused sub-components.
Break up the 1923-line Settings.tsx into Settings/ directory with index.tsx orchestrator plus 7 section components and shared types.
Break up the 1237-line OrgSettings.tsx into OrgSettings/ directory with index.tsx orchestrator plus 4 section components and shared types.
…ormatDuration Remove 5 identical time-formatting functions from TrimModal, FillerRemovalModal, SilenceRemovalModal, CommentsSection, and TranscriptSection — all replaced with existing formatDuration from utils/format.ts.
Split the 1124-line handler.go into handler.go (shared utilities, identity/SCIM management), handler_oidc.go (OIDC flows), and handler_saml.go (SAML flows).
…nents Analytics.tsx (920 lines) → Analytics/ with 8 files. PlaylistDetail.tsx (960 lines) → PlaylistDetail/ with 3 files. Library.tsx (893 lines) → Library/ with 3 files.
|
Preview deployed: https://pr-116.app.sendrec.eu |
|
Preview environment cleaned up. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
sso/handler.go(1124 lines) into protocol-specific files:handler.go,handler_oidc.go,handler_saml.goVideoDetail.tsx(2088 lines) intoVideoDetail/with 4 sub-componentsSettings.tsx(1923 lines) intoSettings/with 9 filesOrgSettings.tsx(1237 lines) intoOrgSettings/with 7 filesAnalytics.tsx(920 lines) intoAnalytics/with 8 filesPlaylistDetail.tsx(960 lines) intoPlaylistDetail/with 3 filesLibrary.tsx(893 lines) intoLibrary/with 3 filesformatTime/formatTimestampfunctions, replaced with sharedformatDurationloadPlaylistVideoshelperuseRecordinghook,useToasthook,ConfirmDialogcomponent, shared types/utilsTest plan
go test ./...)