Skip to content
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

Austenem/CAT-1180 Restrict lists to HuBMAP users #3698

Merged
merged 3 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG-restrict-lists-to-hubmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Restrict "My Lists" feature to HuBMAP users only.
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ function WorkspaceSVGIcon({ color = 'primary', ...props }: SvgIconProps) {

function SaveEditEntityButton({ uuid }: Pick<Entity, 'uuid'>) {
const { savedEntities } = useSavedLists();
const { isAuthenticated } = useAppContext();
const { isHubmapUser } = useAppContext();

if (!isAuthenticated) {
if (!isHubmapUser) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function EditSavedEntityButton({ uuid }: Pick<Entity, 'uuid'>) {

export default function SummarySaveEntityButton({ uuid }: Pick<Entity, 'uuid'>) {
const { savedEntities } = useSavedLists();
const { isAuthenticated } = useAppContext();
const { isHubmapUser } = useAppContext();

if (!isAuthenticated) {
if (!isHubmapUser) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ function SearchPagesPrompt({ capitalize }: { capitalize?: boolean }) {
}

function LoginPrompt({ endingText }: { endingText: string }) {
const { isAuthenticated } = useAppContext();
const { isHubmapUser } = useAppContext();

if (isAuthenticated) {
if (isHubmapUser) {
return null;
}

Expand All @@ -61,11 +61,11 @@ function SavedListMessage() {
}

function SavedListsMessage() {
const { isAuthenticated } = useAppContext();
const { isHubmapUser } = useAppContext();

return (
<>
<LoginPrompt endingText=" or " /> <SearchPagesPrompt capitalize={isAuthenticated} /> to explore data to save
<LoginPrompt endingText=" or " /> <SearchPagesPrompt capitalize={isHubmapUser} /> to explore data to save
</>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function SaveEntitiesButton({
uuids: Set<string>;
fromSelectableTable?: boolean;
}) {
const { isAuthenticated } = useAppContext();
const { isHubmapUser } = useAppContext();
const { savedEntities, handleSaveEntities } = useSavedLists();
const {
entity: { entity_type: page_entity_type },
Expand All @@ -70,7 +70,7 @@ export default function SaveEntitiesButton({
});
});

if (!isAuthenticated) {
if (!isHubmapUser) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const handleTrack = () => {
};

function LocalStorageDescription() {
const { isAuthenticated } = useAppContext();
const { isHubmapUser } = useAppContext();

if (isAuthenticated) {
if (isHubmapUser) {
return <Description>Lists saved here are stored to your profile and are accessible across devices.</Description>;
}

Expand Down
4 changes: 2 additions & 2 deletions context/app/static/js/components/savedLists/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function useUkvHeaders(): HeadersInit {
}

function useHasUkvAccess() {
const { isAuthenticated } = useAppContext();
return Boolean(isAuthenticated);
const { isHubmapUser } = useAppContext();
return Boolean(isHubmapUser);
}

function useBuildUkvSWRKey(): {
Expand Down
4 changes: 2 additions & 2 deletions context/app/static/js/pages/SavedLists/SavedLists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useAppContext } from 'js/components/Contexts';
import SavedListsContent from 'js/components/savedLists/SavedListsContent';

function SavedLists() {
const { isAuthenticated } = useAppContext();
const { isHubmapUser } = useAppContext();

return (
<Stack spacing={1} marginBottom={10}>
Expand All @@ -16,7 +16,7 @@ function SavedLists() {
</Typography>
<Stack spacing={3}>
<SavedListsDescription />
{isAuthenticated && <SavedListsContent />}
{isHubmapUser && <SavedListsContent />}
</Stack>
</Stack>
);
Expand Down
Loading