Skip to content

Commit

Permalink
Fix the timer somewhat
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jan 22, 2025
1 parent 067f0f1 commit 030c1b4
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 178 deletions.
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@
},
"dependencies": {
"@popperjs/core": "^2.11.8",
"@rspack/cli": "^1.1.8",
"@rspack/core": "^1.1.8",
"@rspack/cli": "^1.2.1",
"@rspack/core": "^1.2.1",
"@swc/helpers": "^0.5.15",
"autoprefixer": "^10.4.20",
"bootstrap": "^5.3.3",
"css-loader": "^7.1.2",
"html-webpack-plugin": "^5.6.3",
"popper.js": "^1.16.1",
"postcss-loader": "^8.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react": "^18",
"react-dom": "^18",
"react-draggable": "^4.4.5",
"react-redux": "^9.2.0",
"react-select": "^5.9.0",
"redux": "^5.0.1",
"redux-localstorage": "^0.4.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^3.1.0",
"sass-embedded": "^1.83.4",
"sass-loader": "^16.0.4"
Expand Down
53 changes: 21 additions & 32 deletions timer/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,37 +84,24 @@ export const Activity = connect((state, ownProps) => ({
</div>
<div className="activity-body">
<div className="form-group">
<div className="input-group input-group-sm">
<AsyncSelect
className="select"
classNamePrefix="select"
defaultOptions={projects}
loadOptions={async (inputValue, callback) => {
callback(await fetchProjects(inputValue))
}}
onChange={(value) => {
dispatchUpdate({
title: value.label.replace(/^[-0-9\s]+/, ""),
project: value,
service: null,
})
setServices([])
}}
placeholder={gettext("Select or search project...")}
value={activity.project}
/>
{activity.project && (
<div className="input-group-append">
<a
href={`/projects/${activity.project.value}/`}
className="input-group-text"
title={gettext("Go to the project")}
>
{icons.arrow}
</a>
</div>
)}
</div>
<AsyncSelect
className="select"
classNamePrefix="select"
defaultOptions={projects}
loadOptions={async (inputValue, callback) => {
callback(await fetchProjects(inputValue))
}}
onChange={(value) => {
dispatchUpdate({
title: value.label.replace(/^[-0-9\s]+/, ""),
project: value,
service: null,
})
setServices([])
}}
placeholder={gettext("Select or search project...")}
value={activity.project}
/>
</div>
<div className="form-group">
<Select
Expand Down Expand Up @@ -146,7 +133,9 @@ export const Activity = connect((state, ownProps) => ({
<div className="d-flex align-items-center justify-content-between">
<div
className="activity-duration pl-2"
onClick={() => overwriteSeconds(dispatch, { activity, current })}
onClick={() => {
overwriteSeconds(dispatch, { activity, current })
}}
style={{ cursor: "cell" }}
>
{prettyDuration(activity.seconds)}
Expand Down
2 changes: 1 addition & 1 deletion timer/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ div[role="main"] {
}

.form-group .select {
flex: 1;
max-width: 100%;
}

.select__placeholder {
Expand Down
18 changes: 1 addition & 17 deletions timer/store.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import { applyMiddleware, compose, createStore } from "redux"
import { compose, createStore } from "redux"
import persistState from "redux-localstorage"
import logger from "redux-logger"
import thunk from "redux-thunk"
import reducer from "./reducers"

const VERSION = 3

const initialTitle = document.title
const notifier = (store) => (next) => (action) => {
const state = next(action)
const { current } = store.getState()
document.title = `${current ? "▶ " : ""}${initialTitle}`
return state
}

const serialize = (data) => {
return JSON.stringify({ ...data, _v: VERSION })
}
Expand Down Expand Up @@ -68,12 +58,6 @@ export function configureStore() {
serialize,
deserialize,
}),
applyMiddleware(
notifier,
// remotePersister,
thunk,
logger,
),
),
)

Expand Down
Loading

0 comments on commit 030c1b4

Please sign in to comment.