Add 'Revert All Selection' feature #68
This commit introduces 'Revert: None - Selected' toggle, enabling users to revert all reversible scripts with a single action, improving user safety and control over script effects. This feature addresses user-reported concerns about the ease of reverting script changes. This feature should enhance the user experience by streamlining the revert process along with providing essential information about script reversibility. Key changes: - Add buttons to revert all selected scripts or setting all selected scripts to non-revert state. - Add tooltips with detailed explanations about consequences of modifying revert states, includinginformation about irreversible script changes. Supporting changes: - Align items on top menu vertically for better visual consistency. - Rename `SelectionType` to `RecommendationStatusType` for more clarity. - Rename `IReverter` to `Reverter` to move away from `I` prefix convention. - The `.script` CSS class was duplicated in `TheScriptsView.vue` and `TheScriptsArea.vue`, leading to style collisions in the development environment. The class has been renamed to component-specific classes to avoid such issues in the future.
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<MenuOptionList label="Select">
|
||||
<TooltipWrapper>
|
||||
<!-- None -->
|
||||
<MenuOptionListItem
|
||||
label="None"
|
||||
:enabled="currentRecommendationStatusType !== RecommendationStatusType.None"
|
||||
@click="selectRecommendationStatusType(RecommendationStatusType.None)"
|
||||
/>
|
||||
<template #tooltip>
|
||||
<RecommendationDocumentation
|
||||
:privacy-rating="0"
|
||||
description="Deselects all scripts. Good starting point to review and select individual tweaks."
|
||||
recommendation="Recommended for users who prefer total control over changes. It allows you to examine and select only the tweaks you require."
|
||||
/>
|
||||
</template>
|
||||
</TooltipWrapper>
|
||||
|
||||
<!-- Standard -->
|
||||
<TooltipWrapper>
|
||||
<MenuOptionListItem
|
||||
label="Standard"
|
||||
:enabled="currentRecommendationStatusType !== RecommendationStatusType.Standard"
|
||||
@click="selectRecommendationStatusType(RecommendationStatusType.Standard)"
|
||||
/>
|
||||
<template #tooltip>
|
||||
<RecommendationDocumentation
|
||||
:privacy-rating="2"
|
||||
description="Provides a balanced approach between privacy and functionality."
|
||||
recommendation="Recommended for most users who wish to improve privacy with best-practices without affecting stability."
|
||||
:includes="[
|
||||
'Retains functionality of all apps and system services.',
|
||||
'Clears non-essential OS and app telemetry data and caches.',
|
||||
'Keeps essential security services enabled.',
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</TooltipWrapper>
|
||||
|
||||
<!-- Strict -->
|
||||
<TooltipWrapper>
|
||||
<MenuOptionListItem
|
||||
label="Strict"
|
||||
:enabled="currentRecommendationStatusType !== RecommendationStatusType.Strict"
|
||||
@click="selectRecommendationStatusType(RecommendationStatusType.Strict)"
|
||||
/>
|
||||
<template #tooltip>
|
||||
<RecommendationDocumentation
|
||||
:privacy-rating="3"
|
||||
description="Focuses heavily on privacy by disabling some non-critical functions that could leak data."
|
||||
recommendation="Recommended for advanced users who prioritize privacy over non-essential functionality."
|
||||
:includes="[
|
||||
'Disables optional OS and app services that could leak data.',
|
||||
'Clears non-essential caches, histories, temporary files while retaining browser bookmarks.',
|
||||
'Keeps vital security services and critical application functionality.',
|
||||
]"
|
||||
:considerations="[
|
||||
'Review each script to make sure you are comfortable with the disabled functionality.',
|
||||
'Some non-critical applications or features may no longer function as expected.',
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</TooltipWrapper>
|
||||
|
||||
<!-- All -->
|
||||
<TooltipWrapper>
|
||||
<MenuOptionListItem
|
||||
label="All"
|
||||
:enabled="currentRecommendationStatusType !== RecommendationStatusType.All"
|
||||
@click="selectRecommendationStatusType(RecommendationStatusType.All)"
|
||||
/>
|
||||
<template #tooltip>
|
||||
<RecommendationDocumentation
|
||||
:privacy-rating="4"
|
||||
description="Strongest privacy by disabling any functionality that may risk data exposure."
|
||||
recommendation="Recommended for extreme use cases where no data leak is acceptable like crime labs."
|
||||
:considerations="[
|
||||
'Not recommended for daily use as it breaks important functionality.',
|
||||
'Do not run it without having backups and system snapshots, unless you\'re on a disposable system.',
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</TooltipWrapper>
|
||||
</MenuOptionList>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {
|
||||
defineComponent, computed,
|
||||
} from 'vue';
|
||||
import { injectKey } from '@/presentation/injectionSymbols';
|
||||
import TooltipWrapper from '@/presentation/components/Shared/TooltipWrapper.vue';
|
||||
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
||||
import MenuOptionList from '../MenuOptionList.vue';
|
||||
import MenuOptionListItem from '../MenuOptionListItem.vue';
|
||||
import { setCurrentRecommendationStatus, getCurrentRecommendationStatus } from './RecommendationStatusHandler';
|
||||
import { RecommendationStatusType } from './RecommendationStatusType';
|
||||
import RecommendationDocumentation from './RecommendationDocumentation.vue';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MenuOptionList,
|
||||
MenuOptionListItem,
|
||||
TooltipWrapper,
|
||||
RecommendationDocumentation,
|
||||
},
|
||||
setup() {
|
||||
const {
|
||||
currentSelection, modifyCurrentSelection,
|
||||
} = injectKey((keys) => keys.useUserSelectionState);
|
||||
const { currentState } = injectKey((keys) => keys.useCollectionState);
|
||||
|
||||
const currentCollection = computed<ICategoryCollection>(() => currentState.value.collection);
|
||||
|
||||
const currentRecommendationStatusType = computed<RecommendationStatusType>({
|
||||
get: () => getCurrentRecommendationStatus({
|
||||
selection: currentSelection.value.scripts,
|
||||
collection: currentCollection.value,
|
||||
}),
|
||||
set: (type: RecommendationStatusType) => {
|
||||
selectRecommendationStatusType(type);
|
||||
},
|
||||
});
|
||||
|
||||
function selectRecommendationStatusType(type: RecommendationStatusType) {
|
||||
if (currentRecommendationStatusType.value === type) {
|
||||
return;
|
||||
}
|
||||
modifyCurrentSelection((mutableSelection) => {
|
||||
setCurrentRecommendationStatus(type, {
|
||||
selection: mutableSelection.scripts,
|
||||
collection: currentCollection.value,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
RecommendationStatusType,
|
||||
currentRecommendationStatusType,
|
||||
selectRecommendationStatusType,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user