`VideoSection` can be refactored
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, react
- 领域
- frontend
调研方向
首先比较 src/components/challenges/VideoSection.js 和 src/components/tracks/VideoSection.js 及其 CSS 文件,以确定共享结构和有意的差异。跟踪 Track Stop 和 Part 的点击行为,然后确认重构后的共享组件和合并后的样式保留了两个变体,并解决了重复的 timeline 行为。
由索引模型根据 Issue 内容生成。
描述
I've listed some bugs below, but this is mostly a critique of the code structure which is the overarching problem.
I was trying to fix a small issue in #1339 that requires setting the background of the VideoSection component's .timeline. But there are 2 independent, yet similar implementations of VideoSection for Tracks and Challenges - this required changing 2 files for a feature that is common to both.
In fact, challenges/VideoSection.js and tracks/VideoSection.js are mostly the same except for a few variables and what happens when a "Track Stop" or a "Part" is clicked. Their respective CSS files are have even more similarity, differing in hardly a few lines (and these may be unintentional).
Is this important? Well yeah, because code redundancy has already caused some differences:
| Challenges | Tracks |
|---|---|
Potential Solution
If we refactor VideoSection to be a Class Component instead of a Functional Component, we can inherit from a more general VideoSection that'll make the code more readable and DRY. The CSS files have practically no differences because we pass in the variant programmatically for UI changes. They can be merged, and we can use this merged file for the base VideoSection class.
- 主要语言
- JavaScript
- 星标
- 283
- 派生
- 125
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CodingTrain/thecodingtrain.com 的其他 Issue
-
CodingTrain/thecodingtrain.com#1991 · 1 条评论 · 已指派 1 人 ·
-
难度 3/5 1-2 天 新手友好度 25/100
CodingTrain/thecodingtrain.com#1805 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
CodingTrain/thecodingtrain.com#1785 · 1 个 reaction ·
-
help wanted
难度 5/5 一周以上 新手友好度 25/100
CodingTrain/thecodingtrain.com#1750 ·
-
难度 4/5 3-5 天 新手友好度 35/100
CodingTrain/thecodingtrain.com#1730 ·
查看 CodingTrain/thecodingtrain.com 的全部 Issue
相似的 Issue
-
bug confirmed issue
难度 2/5 1-3 小时 新手友好度 75/100
open-webui/open-webui#30750 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
Mend: dependency security vulnerability untriaged
难度 2/5 1-3 小时 新手友好度 70/100