-
Notifications
You must be signed in to change notification settings - Fork 8
[refactor] redesign User profile page & fix Activity create layout #27
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
Changes from all commits
85b7901
b1c1aa9
ed761c4
a10aca3
b2c26b9
38f018f
b6eb251
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| NEXT_PUBLIC_SITE_NAME = 开放黑客松 | ||
| NEXT_PUBLIC_SITE_NAME = 黑客松开放平台 | ||
| NEXT_PUBLIC_SITE_SUMMARY = 基于 Git 云开发环境的开放黑客马拉松平台 | ||
| NEXT_PUBLIC_API_HOST = https://openhackathon-service.onrender.com | ||
| NEXT_PUBLIC_AUTHING_APP_ID = 60178760106d5f26cb267ac1 | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,9 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Base, User } from '@freecodecamp-chengdu/hop-service'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { clear } from 'idb-keyval'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { HTTPClient } from 'koajax'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { computed, observable } from 'mobx'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { BaseModel, persist, restore, toggle } from 'mobx-restful'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { buildURLData, setCookie } from 'web-utility'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { buildURLData, setCookie, sleep } from 'web-utility'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { API_HOST, isServer, JWT, token } from '../../configuration'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -15,22 +16,20 @@ export const ownClient = new HTTPClient({ baseURI: API_HOST, responseType: 'json | |||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| export interface SessionUser | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| extends Base, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Record<'username' | 'email', string>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Record<'confirmed' | 'blocked', boolean> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| extends Base, Record<'username' | 'email', string>, Record<'confirmed' | 'blocked', boolean> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| provider: 'local' | 'github'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| gender?: 'Female' | 'Male' | 'Other'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| export class SessionModel extends BaseModel { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| client = ownClient; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| restored = !isServer() && restore(this, 'Session'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| @persist() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| @observable | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| accessor user: User | undefined; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| restored = !isServer() && restore(this, 'Session'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| @computed | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| get metaOAuth() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return { github: { accessToken: token } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -59,11 +58,13 @@ export class SessionModel extends BaseModel { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| return body!; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| signOut(reload = false) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| async signOut(reload = false) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| setCookie('token', '', { path: '/', expires: new Date() }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| setCookie('JWT', '', { path: '/', expires: new Date() }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.user = undefined; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| await sleep(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| await clear(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (reload) location.reload(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+61
to
69
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. 🧩 Analysis chain🌐 Web query:
💡 Result: Yes. In idb-keyval v6.x, clear returns a Promise that rejects if the underlying IndexedDB request/transaction fails (which includes cases where IndexedDB can’t be opened/used due to privacy/storage restrictions). Citations:
🏁 Script executed: # First, locate and read the Session.ts file around the target lines
fd -t f "Session.ts" -x wc -l {}Repository: FreeCodeCamp-Chengdu/HOP Length of output: 96 🏁 Script executed: # Read the file content around lines 61-69
fd -t f "Session.ts" -x head -75 {} | tail -20Repository: FreeCodeCamp-Chengdu/HOP Length of output: 518 🏁 Script executed: # Also check the imports and structure
fd -t f "Session.ts" -x head -10 {}Repository: FreeCodeCamp-Chengdu/HOP Length of output: 542 🏁 Script executed: # Search for signOut call sites
rg "signOut\(" --type ts --type tsx -B 2 -A 2Repository: FreeCodeCamp-Chengdu/HOP Length of output: 96 🏁 Script executed: # Search for signOut call sites (without tsx type filter)
rg "signOut\(" --type ts -B 2 -A 2Repository: FreeCodeCamp-Chengdu/HOP Length of output: 1326 🏁 Script executed: # Also try broader search for .tsx files
rg "signOut\(" -B 2 -A 2 | head -50Repository: FreeCodeCamp-Chengdu/HOP Length of output: 1326 Harden sign-out against IndexedDB cleanup failures.
🛡️ Suggested resilient implementation async signOut(reload = false) {
setCookie('token', '', { path: '/', expires: new Date() });
setCookie('JWT', '', { path: '/', expires: new Date() });
this.user = undefined;
await sleep();
- await clear();
+ if (!isServer()) {
+ try {
+ await clear();
+ } catch {
+ // Keep sign-out successful even if client storage cleanup fails
+ }
+ }
- if (reload) location.reload();
+ if (reload && !isServer()) location.reload();
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,7 @@ import { | |||||
| loadSSRLanguage, | ||||||
| } from '../models/Base/Translation'; | ||||||
| import styles from './_app.module.less'; | ||||||
| import sessionStore from '../models/User/Session'; | ||||||
|
|
||||||
| configure({ enforceActions: 'never' }); | ||||||
|
|
||||||
|
|
@@ -45,6 +46,8 @@ export default class CustomApp extends App<I18nProps> { | |||||
|
|
||||||
| if (tips) alert(tips); | ||||||
| }); | ||||||
|
|
||||||
| sessionStore.getProfile().catch(console.debug); | ||||||
|
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. Replace Line 50 violates ✅ Minimal lint-safe patch- sessionStore.getProfile().catch(console.debug);
+ sessionStore.getProfile().catch(console.info);📝 Committable suggestion
Suggested change
🧰 Tools🪛 ESLint[error] 50-50: Unexpected console statement. Only these console methods are allowed: warn, error, info. (no-console) 🤖 Prompt for AI Agents |
||||||
| } | ||||||
|
|
||||||
| render() { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| .hero-section { | ||
| background: radial-gradient(circle at top left, #312e81, #0f172a 55%, #020617); | ||
| padding: 3rem 0 6rem; | ||
| } | ||
|
|
||
| .avatar-placeholder { | ||
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | ||
| width: 7.5rem; | ||
| height: 7.5rem; | ||
| } | ||
|
|
||
| .social-btn { | ||
| transition: all 0.2s ease; | ||
| background: rgba(59, 130, 246, 0.08); | ||
| color: #64748b; | ||
|
|
||
| &:hover { | ||
| background: #2563eb; | ||
| color: white; | ||
| } | ||
|
|
||
| &.active { | ||
| background: #2563eb; | ||
| color: white; | ||
| } | ||
| } | ||
|
|
||
| .custom-tabs { | ||
| gap: 0.5rem; | ||
| margin-bottom: 1.5rem; | ||
| border: none; | ||
|
|
||
| :global(.nav-link) { | ||
|
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. Stylelint is currently failing on CSS Modules Line 33 and Line 47 trigger 💡 Local fix option in this file .custom-tabs {
gap: 0.5rem;
margin-bottom: 1.5rem;
border: none;
+ /* stylelint-disable-next-line selector-pseudo-class-no-unknown */
:global(.nav-link) {
@@
- &:global(.active) {
+ /* stylelint-disable-next-line selector-pseudo-class-no-unknown */
+ &:global(.active) {
background: `#2563eb`;
color: white;
}
}
}Also applies to: 47-47 🧰 Tools🪛 Stylelint (17.9.0)[error] 33-33: Unknown pseudo-class selector ":global" (selector-pseudo-class-no-unknown) (selector-pseudo-class-no-unknown) 🤖 Prompt for AI Agents |
||
| transition: all 0.2s ease; | ||
| border: none; | ||
| border-radius: 0.75rem; | ||
| background: rgba(59, 130, 246, 0.05); | ||
| padding: 0.75rem 1.5rem; | ||
| color: #64748b; | ||
| font-weight: 500; | ||
|
|
||
| &:hover { | ||
| background: rgba(59, 130, 246, 0.1); | ||
| color: #2563eb; | ||
| } | ||
|
|
||
| &:global(.active) { | ||
| background: #2563eb; | ||
| color: white; | ||
| } | ||
| } | ||
| } | ||
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.
Remove spaces around
=in env assignment.Line 1 uses
KEY = value; preferKEY=valueto avoid parser/shell compatibility issues and satisfy dotenv linting.Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 1-1: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
🤖 Prompt for AI Agents