feat: display folders even without the premium (#826)

This commit is contained in:
Laurent Senta
2022-01-26 09:21:24 +01:00
committed by GitHub
parent 86b38e1041
commit 7726b1249c
3 changed files with 6 additions and 12 deletions

View File

@@ -18,7 +18,6 @@ export const RootTagDropZone: React.FC<Props> = observer(
({ tagsState, featuresState }) => {
const premiumModal = usePremiumModal();
const isNativeFoldersEnabled = featuresState.enableNativeFoldersFeature;
const hasFolders = featuresState.hasFolders;
const [{ isOver, canDrop }, dropRef] = useDrop<DropItem, void, DropProps>(
() => ({
@@ -27,11 +26,6 @@ export const RootTagDropZone: React.FC<Props> = observer(
return true;
},
drop: (item) => {
if (!hasFolders) {
premiumModal.activate(TAG_FOLDERS_FEATURE_NAME);
return;
}
tagsState.assignParent(item.uuid, undefined);
},
collect: (monitor) => ({
@@ -39,10 +33,10 @@ export const RootTagDropZone: React.FC<Props> = observer(
canDrop: !!monitor.canDrop(),
}),
}),
[tagsState, hasFolders, premiumModal]
[tagsState, premiumModal]
);
if (!isNativeFoldersEnabled || !hasFolders) {
if (!isNativeFoldersEnabled) {
return null;
}

View File

@@ -120,7 +120,7 @@ export const TagsListItem: FunctionComponent<Props> = observer(
isDragging: !!monitor.isDragging(),
}),
}),
[tag, hasFolders]
[tag, isNativeFoldersEnabled]
);
const [{ isOver, canDrop }, dropRef] = useDrop<DropItem, void, DropProps>(
@@ -160,7 +160,7 @@ export const TagsListItem: FunctionComponent<Props> = observer(
>
{!tag.errorDecrypting ? (
<div className="tag-info" title={title} ref={dropRef}>
{hasFolders && isNativeFoldersEnabled && hasAtLeastOneFolder && (
{isNativeFoldersEnabled && hasAtLeastOneFolder && (
<div
className={`tag-fold ${showChildren ? 'opened' : 'closed'}`}
onClick={hasChildren ? toggleChildren : undefined}

View File

@@ -172,7 +172,7 @@ export class TagsState {
}
getChildren(tag: SNTag): SNTag[] {
if (!this.features.hasFolders) {
if (!this.features.enableNativeFoldersFeature) {
return [];
}
@@ -230,7 +230,7 @@ export class TagsState {
}
get rootTags(): SNTag[] {
if (!this.features.hasFolders) {
if (!this.features.enableNativeFoldersFeature) {
return this.tags;
}