Skip to content

Commit

Permalink
Merge pull request #165 from htrc/share-private-worksets
Browse files Browse the repository at this point in the history
Share private worksets
  • Loading branch information
dkudeki authored Feb 26, 2025
2 parents a806f97 + 87b3c2e commit 1348cf4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.2.3] – 2025-02-26

### Changed
- Names of some widgets and workset sections. [#85](https://github.com/htrc/torchlite-app/issues/85)
- Max public or user workset size dropped to 400 volumes. [#78](https://github.com/htrc/torchlite-app/issues/78)

### Fixed
- Error handling for unauthorized or non-existent workset, should now throw meaningful error [#146](https://github.com/htrc/torchlite-backend/issues/146)

## [0.2.2] – 2025-02-12

### Fixed
Expand Down Expand Up @@ -39,7 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- This CHANGELOG file.
- Share button and popup [#61](https://github.com/htrc/torchlite-app/issues/61)

[unreleased]: https://github.com/htrc/torchlite-frontend/compare/0.2.2...HEAD
[unreleased]: https://github.com/htrc/torchlite-frontend/compare/0.2.3...HEAD
[0.2.3]: https://github.com/htrc/torchlite-frontend/compare/0.2.2...0.2.3
[0.2.2]: https://github.com/htrc/torchlite-frontend/compare/0.2.1...0.2.2
[0.2.1]: https://github.com/htrc/torchlite-frontend/compare/0.2.0...0.2.1
[0.2.0]: https://github.com/htrc/torchlite-frontend/compare/0.1.0...0.2.0
Expand Down
4 changes: 2 additions & 2 deletions src/contexts/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ function AppProvider({ children }: AppProviderProps) {
// Get worksets
let worksets: WorksetList = await getAvailableWorksets();
if (worksets?.public) {
worksets.public = worksets.public.filter((workset) => workset.numVolumes < 1000)
worksets.public = worksets.public.filter((workset) => workset.numVolumes < 400)
}
if (worksets?.user) {
worksets.user = worksets.user.filter((workset) => workset.numVolumes < 1000)
worksets.user = worksets.user.filter((workset) => workset.numVolumes < 400)
}
setAvailableWorksets(worksets);

Expand Down
6 changes: 3 additions & 3 deletions src/data/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export const WidgetInfoLinks: any = {
};

export const WidgetTitles: any = {
MappingContributorData: 'Mapping Contributor Data',
MappingContributorData: 'Mapping Creator Birthplaces',
PublicationDateTimeline: 'Publication Date Timeline',
Summary: 'Summary',
SimpleTagCloud: 'Simple Word Cloud'
Summary: 'Workset Summary',
SimpleTagCloud: 'Word Frequency Cloud'
};

export const TableColumns: any = {
Expand Down
2 changes: 1 addition & 1 deletion src/layout/MainLayout/SideBar/WorksetWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const WorksetWidget = () => {
<Stack sx={{ margin: theme.spacing(1) }} spacing={2}>
<FormControl sx={{ minWidth: 120 }}>
<Select value={type} color="secondary" onChange={handleChange}>
<MenuItem value={'featured'}>Recommended Worksets</MenuItem>
<MenuItem value={'featured'}>Featured Worksets</MenuItem>
<MenuItem value={'public'}>All Worksets</MenuItem>
{availableWorksets?.user?.length ? <MenuItem value={'user'}>My Worksets</MenuItem> : <></>}
</Select>
Expand Down
13 changes: 9 additions & 4 deletions src/pages/api/dashboards/[id]/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
if (isValidBody<DashboardStatePatch>(req.body, DashboardStatePatchSchema)) {
await patchDashboard(dashboardId, req.body, headers);
res.status(204).end();
} else return res.status(400).end();
}
break;
}
} catch (err) {
console.error(err);
res.status(500).json({ message: 'Internal server error' });
} catch (err: any) {
console.log(err);
if (err.status == 400) {
res.status(400).end();
}
else {
res.status(500).json({ message: 'Internal server error' });
}
}
}
2 changes: 1 addition & 1 deletion src/utils/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ axiosServices.interceptors.response.use(
})
);
}
return Promise.reject((error.response && error.response.data) || 'Wrong Services');
return Promise.reject((error.response && {data: error.response.data, status: error.response.status}) || 'Wrong Services');
}
);

Expand Down

0 comments on commit 1348cf4

Please sign in to comment.