Skip to content

Add preset time dropdowns for work, rest, and loop durations #134

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
307 changes: 254 additions & 53 deletions index.html

Large diffs are not rendered by default.

789 changes: 395 additions & 394 deletions locales/en.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,5 +394,6 @@
"can-redo-msg": "是否需要对当前段时间进行重新计时?",
"custom": "自定义",
"custom-notify-sound": "自定义提示音",
"input-url": "输入路径"
"input-url": "输入路径",
"minutes": "minutes-[zh-CN]"
Copy link
Owner

Choose a reason for hiding this comment

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

Redundant string is not OK for all three language jsons.

}
3 changes: 2 additions & 1 deletion locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,6 @@
"increase-1-minute": "增加1分鐘",
"decrease-15-seconds": "減少15秒",
"increase-15-seconds": "增加15秒",
"not_for_stopwatch": "不適用於正計時模式"
"not_for_stopwatch": "不適用於正計時模式",
"minutes": "minutes-[zh-TW]"
}
275 changes: 273 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,166 @@ li input:nth-last-child(4)::after {
-webkit-user-select: none;
}

.dropdown-menu.show {
display: block;
}

.time-preset-dropdown {
display: inline-block;
position: relative;
margin-left: 1px;
margin-right: 5px;
vertical-align: middle;
width: auto;
}

.time-preset-dropdown .dropdown-toggle {
padding: 0;
margin: 0;
background: transparent;
border: none;
display: inline-block;
vertical-align: middle;
line-height: 1;
}

.time-preset-dropdown .dropdown-toggle::after {
display: none;
}

.time-preset-dropdown .dropdown-toggle i {
color: #6c757d;
font-size: 14px;
vertical-align: middle;
position: relative;
top: -1px;
transition: transform 0.2s ease-in-out;
}

.time-preset-dropdown .dropdown-toggle[aria-expanded="true"] i {
transform: rotate(180deg);
}

.time-preset-dropdown .dropdown-toggle i.work {
color: #ea5454;
}

.time-preset-dropdown .dropdown-toggle i.rest {
color: #5490ea;
}

.time-preset-dropdown .dropdown-toggle i.onlyRest {
color: #a26ae5;
}

.time-preset-dropdown .dropdown-menu {
min-width: 85px;
text-align: center;
margin-top: 0;
font-size: 14px;
z-index: 1500;
max-height: 84px; /* Height for 3 items (28px per item) */
overflow-y: auto;
padding: 5px 0;
position: absolute;
top: 100%;
left: auto;
right: auto;
}

.time-preset-dropdown .dropdown-menu .dropdown-item {
padding: 0.25rem 0.5rem;
height: 28px;
line-height: 1.5;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
font-weight: normal;
background-color: white !important;
opacity: 1 !important;
}

.align-content-center {
position: relative;
text-align: center;
}

#work-time-presets-dropdown + .dropdown-menu,
#rest-time-presets-dropdown + .dropdown-menu,
#rest-time-onlyrest-presets-dropdown + .dropdown-menu,
#loop-presets-dropdown + .dropdown-menu {
width: 192px;
min-width: 192px;
background-color: white !important;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
position: absolute;
transform: translateX(-173px);
z-index: 1500;
opacity: 1 !important;
margin-top: 5px;
left: 0;
top: 100%;
}

#work-time-presets-dropdown + .dropdown-menu .dropdown-item,
#rest-time-presets-dropdown + .dropdown-menu .dropdown-item,
#rest-time-onlyrest-presets-dropdown + .dropdown-menu .dropdown-item,
#loop-presets-dropdown + .dropdown-menu .dropdown-item {
background-color: white;
opacity: 1;
}

.dropdown-item {
font-size: 12px;
line-height: 200%;
background-color: white;
}

#work-time-presets-dropdown + .dropdown-menu .dropdown-item {
color: #ea5454;
background-color: white;
}

#work-time-presets-dropdown + .dropdown-menu .dropdown-item:hover,
#work-time-presets-dropdown + .dropdown-menu .dropdown-item:focus {
color: #ea5454;
background-color: rgba(234, 84, 84, 0.1);
}

#rest-time-presets-dropdown + .dropdown-menu .dropdown-item {
color: #5490ea;
background-color: white;
}

#rest-time-presets-dropdown + .dropdown-menu .dropdown-item:hover,
#rest-time-presets-dropdown + .dropdown-menu .dropdown-item:focus {
color: #5490ea;
background-color: rgba(84, 144, 234, 0.1);
}

#rest-time-onlyrest-presets-dropdown + .dropdown-menu .dropdown-item {
color: #a26ae5;
background-color: white;
}

#rest-time-onlyrest-presets-dropdown + .dropdown-menu .dropdown-item:hover,
#rest-time-onlyrest-presets-dropdown + .dropdown-menu .dropdown-item:focus {
color: #a26ae5;
background-color: rgba(162, 106, 229, 0.1);
}

#loop-presets-dropdown + .dropdown-menu .dropdown-item {
color: #6c757d;
background-color: white;
}

#loop-presets-dropdown + .dropdown-menu .dropdown-item:hover,
#loop-presets-dropdown + .dropdown-menu .dropdown-item:focus {
color: #6c757d;
background-color: rgba(108, 117, 125, 0.1);
}

.time-bar-focus {
Expand Down Expand Up @@ -417,8 +574,9 @@ li input:nth-last-child(4)::after {
}

#set .dropdown-menu {
margin-top: 6px;
transform: translateY(50px) !important;
margin-top: 5px;
transform: translateY(0px) !important;
transform: translateX(-191px) !important;
}

#set #dropdown-menu-extend {
Expand Down Expand Up @@ -1030,3 +1188,116 @@ li input:nth-last-child(4)::after {
.hotkey-set-label {
padding-top: 0 !important;
}

/* Position dropdown menus properly */
.dropdown-menu.show {
display: block;
}

.time-preset-dropdown .dropdown-menu .dropdown-item {
padding: 0.25rem 0.5rem;
height: 28px;
line-height: 1.5;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
font-weight: normal;
background-color: white !important;
opacity: 1 !important;
}

/* Dark mode support for dropdowns */
.dark-theme .dropdown-menu {
background-color: #2a2a2a !important;
border-color: #444444 !important;
}

.dark-theme .dropdown-item {
background-color: #2a2a2a !important;
}

.dark-theme .dropdown-item:hover,
.dark-theme .dropdown-item:focus {
background-color: #3a3a3a !important;
}

/* Specific dropdown overrides for dark mode */
.dark-theme #work-time-presets-dropdown + .dropdown-menu,
.dark-theme #rest-time-presets-dropdown + .dropdown-menu,
.dark-theme #rest-time-onlyrest-presets-dropdown + .dropdown-menu,
.dark-theme #loop-presets-dropdown + .dropdown-menu {
background-color: #2a2a2a !important;
border: 1px solid #444444 !important;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
}

.dark-theme .dropdown-menu * {
background-color: #2a2a2a !important;
}

.dark-theme .time-preset-dropdown .dropdown-menu {
background-color: #2a2a2a !important;
}

.dark-theme .time-preset-dropdown .dropdown-menu .dropdown-item {
background-color: #2a2a2a !important;
color: #e0e0e0 !important;
}

.dark-theme #work-time-presets-dropdown + .dropdown-menu .dropdown-item,
.dark-theme #rest-time-presets-dropdown + .dropdown-menu .dropdown-item,
.dark-theme #rest-time-onlyrest-presets-dropdown + .dropdown-menu .dropdown-item,
.dark-theme #loop-presets-dropdown + .dropdown-menu .dropdown-item {
background-color: #2a2a2a !important;
}

.dark-theme #work-time-presets-dropdown + .dropdown-menu .dropdown-item:hover,
.dark-theme #work-time-presets-dropdown + .dropdown-menu .dropdown-item:focus,
.dark-theme #rest-time-presets-dropdown + .dropdown-menu .dropdown-item:hover,
.dark-theme #rest-time-presets-dropdown + .dropdown-menu .dropdown-item:focus,
.dark-theme #rest-time-onlyrest-presets-dropdown + .dropdown-menu .dropdown-item:hover,
.dark-theme #rest-time-onlyrest-presets-dropdown + .dropdown-menu .dropdown-item:focus,
.dark-theme #loop-presets-dropdown + .dropdown-menu .dropdown-item:hover,
.dark-theme #loop-presets-dropdown + .dropdown-menu .dropdown-item:focus {
background-color: #3a3a3a !important;
}

/* No need to specify text colors for specific dropdown items in dark mode
as they will use the dynamic colors from theme.js */

/* Make scrollbar more visible in dark mode */
.dark-theme ::-webkit-scrollbar-track {
background-color: #2a2a2a;
}

.dark-theme ::-webkit-scrollbar-thumb {
background-color: #555555;
}

.dark-theme ::-webkit-scrollbar-thumb:active {
background-color: #777777;
}

/* Additional dark mode fixes for dropdown items */
.dark-theme .dropdown-menu,
.dark-theme .dropdown-menu .dropdown-item,
.dark-theme .dropdown-menu a,
.dark-theme .dropdown-menu div {
background-color: #2a2a2a !important;
}

.dark-theme #work-time-presets-dropdown + .dropdown-menu .dropdown-item,
.dark-theme #rest-time-presets-dropdown + .dropdown-menu .dropdown-item,
.dark-theme #rest-time-onlyrest-presets-dropdown + .dropdown-menu .dropdown-item,
.dark-theme #loop-presets-dropdown + .dropdown-menu .dropdown-item {
background-color: #2a2a2a !important;
}

/* Override any inline styles */
.dark-theme .dropdown-menu a[style*="background-color"],
.dark-theme .dropdown-menu .dropdown-item[style*="background-color"] {
background-color: #2a2a2a !important;
}

/* Make scrollbar more visible in dark mode */
Loading