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

feat: fixing microsdeck dependency #129

Merged

Conversation

CEbbinghaus
Copy link
Contributor

This PR cleans up some of the previous dependencies on MicroSDeck to make fallback behavior cleaner for when MicroSDeck is not installed.

Goals:

  • Grayed out MicroSDeck specific filters when not installed
  • Invalidate all existing filters if MicroSDeck cannot be found
  • Ensure event subscriber is triggered even if MicroSDeck is installed post TabMaster
  • Clean up after myself.

Comment on lines 91 to 92
"current card": "Selects apps that are present on the current MicroSD Card",
"on card": "Selects apps that are present on a given MicroSD Card"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rename to "Current MicroSD Card" & "On MicroSD Card"

@CEbbinghaus
Copy link
Contributor Author

This follows on from #128 I am planning to address a lot of the comments from it here

# Conflicts:
#	src/components/filters/FilterSelect.tsx
# Conflicts:
#	src/index.tsx
#	src/state/TabMasterManager.tsx
@CEbbinghaus CEbbinghaus force-pushed the Feat/MicroSDeckIntegration branch from bd89c61 to fcdadbd Compare November 28, 2023 11:02
@CEbbinghaus CEbbinghaus force-pushed the Feat/MicroSDeckIntegration branch from aa6e202 to f2b8825 Compare November 28, 2023 15:35
Copy link
Collaborator

@jessebofill jessebofill left a comment

Choose a reason for hiding this comment

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

please open a new pr with only these changes

"@cebbinghaus/microsdeck": "0.9.6-3b08037",
"@cebbinghaus/microsdeck": "0.9.7-ea88921",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Include

Copy link
Collaborator

Choose a reason for hiding this comment

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

Include

Comment on lines -66 to +52
<Focusable
focusWithinClassName="gpfocuswithin"
onActivate={focusable || selected === filterType ? () => {} : undefined}
style={{ width: "100%", margin: 0, marginBottom: "10px", padding: 0 }}
onOKButton={focusable || selected === filterType ? () => handleSelect(filterType) : undefined}
>
<div
className={achievementClasses.AchievementListItemBase}
style={{ display: "flex", flexDirection: "column", padding: "0.5em", height: "60px" }}
>
<div className="entry-label">{capitalizeEachWord(filterType)}</div>
<div className="entry-desc">{filterDescriptions[filterType]}</div>
</div>
</Focusable>
<FilterSelectElement
disabled={disabled}
filterType={filterType}
handleSelect={focusable || selected === filterType ? () => handleSelect(filterType) : undefined}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

include

Comment on lines +61 to +97
interface FilterSelectElement {
filterType: FilterType,
disabled: boolean,
handleSelect: (() => void) | undefined;
}

/**
* Individual Filter in the filter selection Modal
*/
const FilterSelectElement: VFC<FilterSelectElement> = ({ filterType, disabled, handleSelect }) => {

const pluginSource = FilterPluginSource[filterType];

const pluginNotice = !pluginSource ? "" : (
<small style={{ marginLeft: "0.5em", fontSize: "0.5em" }}>(requires {pluginSource})</small>
);

return (
<Focusable
focusWithinClassName="gpfocuswithin"
style={{ width: "100%", margin: 0, marginBottom: "10px", padding: 0 }}
onOKButton={disabled ? e => e.preventDefault() : handleSelect}
>
<div
className={`${achievementClasses.AchievementListItemBase} ${disabled && "entry-disabled"}`}
style={{ display: "flex", flexDirection: "column", padding: "0.5em", height: "60px" }}
>
<div className="entry-label">
{capitalizeEachWord(filterType)}
{pluginNotice}
</div>
<div className="entry-desc">{FilterDescriptions[filterType]}</div>
</div>
</Focusable>
);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

include

Comment on lines +119 to +140
/**
* Which plugin needs to be installed for this filter to be active
*/
export const FilterPluginSource: { [key in FilterType]?: PluginSources } = {
"sd card": "MicroSDeck",
};

/**
* Whether the filter is disabled (cannot be selected or run)
* @param filter The filter to check.
* @returns True if the filter should be considered disabled
*/
export function isFilterDisabled(filter: FilterType): boolean {
switch (filter) {
case "sd card":
return !MicroSDeck
default:
return false;
}
}


Copy link
Collaborator

Choose a reason for hiding this comment

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

include

Copy link
Collaborator

Choose a reason for hiding this comment

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

include

Copy link
Collaborator

Choose a reason for hiding this comment

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

include

Copy link
Collaborator

Choose a reason for hiding this comment

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

include

Copy link
Collaborator

Choose a reason for hiding this comment

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

include

Copy link
Collaborator

Choose a reason for hiding this comment

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

include

@jessebofill jessebofill merged commit b5d28a3 into Tormak9970:sdcard-filter Nov 29, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants