-
Notifications
You must be signed in to change notification settings - Fork 29
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
app-project: Redesign how your stats are displayed on the classify page #6472
Changes from all commits
4e1f716
015eaa1
0a67bde
d669f06
abe26aa
9468468
6db35bd
465891f
10a9912
be27129
b8720b7
7705b3f
89251aa
66ff700
d7ec5b0
5624eb5
c59c58b
89d5e36
3f2b679
968154c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,18 +55,7 @@ | |
"title": "There was an error in the classifier :(" | ||
} | ||
}, | ||
"FinishedForTheDay": { | ||
"buttons": { | ||
"stats": "See the stats" | ||
}, | ||
"text": "Your answers are saved for the research team while you're working. See the project stats and return to the {{projectName}} home page.", | ||
"title": "Finished for the day?", | ||
"ProjectImage": { | ||
"alt": "Image for {{projectName}}" | ||
} | ||
}, | ||
"RecentSubjects": { | ||
"text": "Discuss a subject on Talk, or add it to your Favourites or a collection.", | ||
"title": "Your recent classifications" | ||
}, | ||
"WorkflowAssignmentModal": { | ||
|
@@ -77,13 +66,10 @@ | |
"title": "New Workflow Available" | ||
}, | ||
"YourStats": { | ||
"todaysCount": "Classifications today", | ||
"totalCount": "Classifications total", | ||
"text": "Keep up the great work!", | ||
"title": "Your {{projectName}} statistics", | ||
"DailyClassificationsChart": { | ||
"title": "{{projectName}} daily classification counts" | ||
} | ||
"allTime": "All Time", | ||
"lastSeven": "Last 7 Days", | ||
"link": "See more", | ||
"title": "Your Stats" | ||
Comment on lines
-80
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm able to reuse |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ | |
"dismiss": "今後メッセージを表示しない" | ||
}, | ||
"YourStats": { | ||
"title": "{{projectName}} 統計" | ||
"title": "統計" | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
}, | ||
"Classify": { | ||
"YourStats": { | ||
"title": "{{projectName}} statystyka" | ||
"title": "statystyka" | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
}, | ||
"Classify": { | ||
"YourStats": { | ||
"title": "{{projectName}} 数据" | ||
"title": "数据" | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
"title": "這些是你最近完成的分類" | ||
}, | ||
"YourStats": { | ||
"title": "{{projectName}} 數據" | ||
"title": "數據" | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export { default as useAdminMode } from './useAdminMode.js' | ||
export { default as useUserFavourites } from './useUserFavourites.js' | ||
export { default as usePanoptesAuth } from './usePanoptesAuth.js' | ||
export { default as usePanoptesAuthToken } from './usePanoptesAuthToken.js' | ||
export { default as usePanoptesUser } from './usePanoptesUser.js' | ||
export { default as usePreferredTheme } from './usePreferredTheme.js' | ||
export { default as useSugarProject } from './useSugarProject.js' |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,10 +1,13 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* This hook will be fully replaced with usePanoptesAuthToken. See PR 6472 for more info */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import auth from 'panoptes-client/lib/auth' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { useEffect, useState } from 'react' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
export default function usePanoptesAuth(userID) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const [authorization, setAuthorization] = useState() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
async function checkAuth() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auth.checkCurrent() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const token = await auth.checkBearerToken() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+10
to
11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is inspired by #6345. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You’ll need front-end-monorepo/packages/lib-react-components/src/hooks/useUnreadMessages.js Lines 20 to 21 in cb221b9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that I look at this hook again, it's broken. It saves the bearer token in component state, so that it gets reused even after it has expired. This hook won't refresh expired auth tokens. Panoptes refresh tokens are valid for something like 2 weeks, but auth tokens only last for two hours. Your code will work for the first two hours of any browser session, then stop fetching after that. That's my fault. I think I wrote this before I properly understood how OAuth works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const bearerToken = token ? `Bearer ${token}` : '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
setAuthorization(bearerToken) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -15,4 +18,4 @@ export default function usePanoptesAuth(userID) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, [userID]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return authorization | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
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.
This component is deleted for good, so its translation keys are deleted throughout.