Skip to content

Achievements Page Mobile View #2868

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

Merged
merged 19 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
104 changes: 57 additions & 47 deletions src/commons/achievement/AchievementManualEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,53 +95,63 @@ const AchievementManualEditor: React.FC<Props> = props => {

return (
<div className="achievement-manual-editor">
<h3>User: </h3>
<UserSelect
filterable={true}
items={users}
itemRenderer={userRenderer}
itemPredicate={userPredicate}
onItemSelect={changeSelectedUser}
noResults={<MenuItem disabled={true} text="No matching user" />}
>
<Button
outlined={true}
text={selectedUser ? selectedUser.name || selectedUser.username : 'No User Selected'}
color="White"
/>
</UserSelect>

<h3>Goal: </h3>
<GoalSelect
filterable={true}
items={manualAchievements}
itemRenderer={goalRenderer}
itemPredicate={goalPredicate}
onItemSelect={changeGoal}
noResults={<MenuItem disabled={true} text="No matching goal" />}
>
<Button outlined={true} text={goal ? goal.text : 'No Goal Selected'} color="White" />
</GoalSelect>

<h3>Count: </h3>
<NumericInput
value={count}
min={0}
allowNumericCharactersOnly={true}
minorStepSize={null}
placeholder="Count"
onValueChange={changeCount}
/>

<h3> </h3>
<Button outlined={true} text="Update Goal" onClick={updateGoal} intent="primary" />

<h3> </h3>
<Checkbox
checked={viewHidden}
label="View Hidden Achievements"
onChange={() => changeViewHidden(!viewHidden)}
/>
<div className="achievement-manual-editor">
Copy link
Member

Choose a reason for hiding this comment

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

You are wrapping an achievement-manual-editor inside an achievement-manual-editor, is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, I have undid this change in a newer commit.

<div className="editor-section">
<h3>User: </h3>
<UserSelect
filterable={true}
items={users}
itemRenderer={userRenderer}
itemPredicate={userPredicate}
onItemSelect={changeSelectedUser}
noResults={<MenuItem disabled={true} text="No matching user" />}
>
<Button
outlined={true}
text={selectedUser ? selectedUser.name || selectedUser.username : 'No User Selected'}
color="White"
/>
</UserSelect>
</div>

<div className="editor-section">
<h3>Goal: </h3>
<GoalSelect
filterable={true}
items={manualAchievements}
itemRenderer={goalRenderer}
itemPredicate={goalPredicate}
onItemSelect={changeGoal}
noResults={<MenuItem disabled={true} text="No matching goal" />}
>
<Button outlined={true} text={goal ? goal.text : 'No Goal Selected'} color="White" />
</GoalSelect>
</div>

<div className="editor-section">
<h3>Count: </h3>
<NumericInput
value={count}
min={0}
allowNumericCharactersOnly={true}
minorStepSize={null}
placeholder="Count"
onValueChange={changeCount}
/>
</div>

<div className="editor-section">
<Button outlined={true} text="Update Goal" onClick={updateGoal} intent="primary" />
</div>

<div className="editor-section">
<Checkbox
checked={viewHidden}
label="View Hidden Achievements"
onChange={() => changeViewHidden(!viewHidden)}
/>
</div>
</div>
</div>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/commons/achievement/utils/AchievementInferencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ class AchievementInferencer {
// finally, process the nodeList
this.processNodes();
this.normalizePositions(achievement.uuid, achievement.position);

return newUuid;
}

Expand Down
6 changes: 3 additions & 3 deletions src/pages/achievement/subcomponents/AchievementDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IconNames } from '@blueprintjs/icons';
import React, { useEffect, useMemo, useState } from 'react';
import { useDispatch } from 'react-redux';
import { Role } from 'src/commons/application/ApplicationTypes';
import { useSession, useTypedSelector } from 'src/commons/utils/Hooks';
import { useResponsive, useSession, useTypedSelector } from 'src/commons/utils/Hooks';

import AchievementFilter from '../../../commons/achievement/AchievementFilter';
import AchievementManualEditor from '../../../commons/achievement/AchievementManualEditor';
Expand Down Expand Up @@ -52,6 +52,7 @@ const AchievementDashboard: React.FC = () => {
// default nothing selected
const userIdState = useState<AchievementUser | undefined>(undefined);
const [selectedUser] = userIdState;
const { isMobileBreakpoint } = useResponsive();

const {
group,
Expand Down Expand Up @@ -156,8 +157,7 @@ const AchievementDashboard: React.FC = () => {
updateGoalProgress={handleUpdateGoalProgress}
/>
)}

<div className="achievement-main">
<div className={isMobileBreakpoint ? 'achievement-main-mobile' : 'achievement-main'}>
<div className="filter-container">
<AchievementFilter
filterState={filterState}
Expand Down
Loading