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

Get Resources (moved) and Home extensions #1363

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d09b405
Add multi-select to combobox, and option to keep dropdown open
rolfheij-sil Nov 21, 2024
98c384c
Uodate PBR
rolfheij-sil Nov 21, 2024
6289f62
Merge branch 'main' into add-multiselect-to-combobox
rolfheij-sil Nov 21, 2024
fafa552
Add more features to combobox
rolfheij-sil Nov 21, 2024
0f4469d
Build PBR
rolfheij-sil Nov 21, 2024
beea93f
Add align menu prop
rolfheij-sil Nov 21, 2024
f1956b1
Clean up logic in example
rolfheij-sil Nov 21, 2024
f432c1b
Merge branch 'main' into add-multiselect-to-combobox
rolfheij-sil Nov 21, 2024
2087fd5
Merge branch 'main' into add-multiselect-to-combobox
rolfheij-sil Nov 22, 2024
69e46c9
Merge branch 'main' into add-multiselect-to-combobox
rolfheij-sil Nov 25, 2024
0a4c172
Squashed 'extensions/src/platform-get-resources/' content from commit…
rolfheij-sil Nov 28, 2024
1ecaf80
Merge commit '0a4c172b09a54b38e8b6197a2f7a06f34038726b' as 'extension…
rolfheij-sil Nov 28, 2024
a298d87
Move Get Resources to core (and rename from Download Resources)
rolfheij-sil Nov 28, 2024
b985c01
Squashed 'extensions/src/platform-home/' content from commit 93d4b0a63
rolfheij-sil Nov 28, 2024
07c58af
Merge commit 'b985c01d7536a1ac5207388e47ef74723ece22d2' as 'extension…
rolfheij-sil Nov 28, 2024
bb091b7
Create Home extension (inspired by Get Resources)
rolfheij-sil Nov 28, 2024
cb4c4b2
Cleanup home webview
rolfheij-sil Nov 28, 2024
01db779
Add new multi-select-combo-box component
rolfheij-sil Dec 2, 2024
584a45e
Merge branch 'main' into add-multiselect-to-combobox
rolfheij-sil Dec 2, 2024
83d7953
Merge branch 'add-multiselect-to-combobox' into 1290-v2-resources-and…
rolfheij-sil Dec 2, 2024
e49c702
Update package-lock.json
rolfheij-sil Dec 2, 2024
5b9fb08
Update links to core
rolfheij-sil Dec 2, 2024
aed2c2d
Export multi-select combo box
rolfheij-sil Dec 2, 2024
de55698
Merge branch 'add-multiselect-to-combobox' into 1290-v2-resources-and…
rolfheij-sil Dec 2, 2024
7174608
Ignore stupid error
rolfheij-sil Dec 2, 2024
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
16 changes: 8 additions & 8 deletions assets/localization/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
"%about_db_ip_attribution_format%": "{intro} {websiteLink} ({license}, {terms})",
"%about_db_ip_attribution_intro%": "Internet safety features use data from",
"%about_db_ip_attribution_terms%": "Terms",
"%downloadResources_errorRegistrationInvalid%": "User registration is not valid. Cannot retrieve resources from DBL.",
"%downloadResources_errorInstallResource_resourceNotFound%": "Resource not available from DBL",
"%downloadResources_errorInstallResource_resourceAlreadyInstalled%": "Resource is already installed and up to date. Installation skipped.",
"%downloadResources_errorInstallResource_installationFailed%": "Resource cannot be found after attempted installation. Installation failed.",
"%downloadResources_errorUninstallResource_resourceNotFound%": "Resource not found on list of DBL resources.",
"%downloadResources_errorUninstallResource_resourceNotInstalled%": "Resource is not currently installed, so it can't be removed.",
"%downloadResources_errorUninstallResource_localResourceNotFound%": "Resource cannot be located, so it can't be removed.",
"%downloadResources_errorUninstallResource_localResourceStillPresent%": "Resource is still present. Removing failed.",
"%downloadUpdateProjectTab_aria_downloadable%": "downloadable projects",
"%downloadUpdateProjectTab_aria_downloaded%": "downloaded projects",
"%downloadUpdateProjectTab_button_delete%": "Delete",
Expand All @@ -20,6 +12,14 @@
"%downloadUpdateProjectTab_title_downloadUpdate%": "Download/Update Project",
"%general_button_submit%": "Submit",
"%general_cancel%": "Cancel",
"%getResources_errorRegistrationInvalid%": "User registration is not valid. Cannot retrieve resources from DBL.",
"%getResources_errorInstallResource_resourceNotFound%": "Resource not available from DBL",
"%getResources_errorInstallResource_resourceAlreadyInstalled%": "Resource is already installed and up to date. Installation skipped.",
"%getResources_errorInstallResource_installationFailed%": "Resource cannot be found after attempted installation. Installation failed.",
"%getResources_errorUninstallResource_resourceNotFound%": "Resource not found on list of DBL resources.",
"%getResources_errorUninstallResource_resourceNotInstalled%": "Resource is not currently installed, so it can't be removed.",
"%getResources_errorUninstallResource_localResourceNotFound%": "Resource cannot be located, so it can't be removed.",
"%getResources_errorUninstallResource_localResourceStillPresent%": "Resource is still present. Removing failed.",
"%insertNote%": "Insert Note",
"%general_error_title%": "Error",
"%general_loading%": "Loading",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Paranext.DataProvider.Projects.DigitalBibleLibrary;
/// Data provider that can install, update and uninstall DBL (Digital Bible Library) resources
/// </summary>
internal class DblResourcesDataProvider(PapiClient papiClient)
: NetworkObjects.DataProvider("paratextBibleDownloadResources.dblResourcesProvider", papiClient)
: NetworkObjects.DataProvider("platformGetResources.dblResourcesProvider", papiClient)
{
#region Internal classes

Expand Down Expand Up @@ -101,7 +101,7 @@ private List<DblResourceData> GetDblResources(JsonElement _ignore)
throw new Exception(
LocalizationService.GetLocalizedString(
PapiClient,
"%downloadResources_errorRegistrationInvalid%",
"%getResources_errorRegistrationInvalid%",
$"User registration is not valid. Cannot retrieve resources from DBL."
)
);
Expand Down Expand Up @@ -146,7 +146,7 @@ private void InstallDblResource(string DBLEntryUid)
DBLEntryUid,
LocalizationService.GetLocalizedString(
PapiClient,
"%downloadResources_errorInstallResource_resourceNotFound%",
"%getResources_errorInstallResource_resourceNotFound%",
$"Resource not available from DBL."
),
out var installableResource
Expand All @@ -156,7 +156,7 @@ out var installableResource
throw new Exception(
LocalizationService.GetLocalizedString(
PapiClient,
"%downloadResources_errorInstallResource_resourceAlreadyInstalled%",
"%getResources_errorInstallResource_resourceAlreadyInstalled%",
$"Resource is already installed and up to date. Installation skipped."
)
);
Expand All @@ -170,7 +170,7 @@ out var installableResource
throw new Exception(
LocalizationService.GetLocalizedString(
PapiClient,
"%downloadResources_errorInstallResource_installationFailed%",
"%getResources_errorInstallResource_installationFailed%",
$"Resource cannot be found after attempted installation. Installation failed."
)
);
Expand All @@ -187,7 +187,7 @@ private void UninstallDblResource(string DBLEntryUid)
DBLEntryUid,
LocalizationService.GetLocalizedString(
PapiClient,
"%downloadResources_errorUninstallResource_resourceNotFound%",
"%getResources_errorUninstallResource_resourceNotFound%",
$"Resource not found on list of DBL resources."
),
out var installableResource
Expand All @@ -197,7 +197,7 @@ out var installableResource
throw new Exception(
LocalizationService.GetLocalizedString(
PapiClient,
"%downloadResources_errorUninstallResource_resourceNotInstalled%",
"%getResources_errorUninstallResource_resourceNotInstalled%",
$"Resource is not currently installed, so it can't be removed."
)
);
Expand All @@ -209,7 +209,7 @@ out var installableResource
throw new Exception(
LocalizationService.GetLocalizedString(
PapiClient,
"%downloadResources_errorUninstallResource_localResourceNotFound%",
"%getResources_errorUninstallResource_localResourceNotFound%",
$"Resource cannot be located, so it can't be removed."
)
);
Expand All @@ -224,7 +224,7 @@ out var installableResource
throw new Exception(
LocalizationService.GetLocalizedString(
PapiClient,
"%downloadResources_errorUninstallResource_localResourceStillPresent%",
"%getResources_errorUninstallResource_localResourceStillPresent%",
$"Resource is still present. Removing failed."
)
);
Expand Down
16 changes: 16 additions & 0 deletions extensions/src/platform-get-resources/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100

[*.md]
trim_trailing_whitespace = false

[*.cs]
indent_size = 4
35 changes: 35 additions & 0 deletions extensions/src/platform-get-resources/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# #region shared with https://github.com/paranext/paranext-multi-extension-template/blob/main/.eslintignore

# Please keep this file in sync with .prettierignore and .stylelintignore

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# OSX
.DS_Store

.idea
npm-debug.log.*
*.css.d.ts
*.sass.d.ts
*.scss.d.ts

# Built files
dist
release
temp-build

# generated files
package-lock.json

# #endregion
170 changes: 170 additions & 0 deletions extensions/src/platform-get-resources/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
// #region shared with https://github.com/paranext/paranext-multi-extension-template/blob/main/.eslintrc.cjs

module.exports = {
extends: [
// https://github.com/electron-react-boilerplate/eslint-config-erb/blob/main/index.js
// airbnb rules are embedded in erb https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
'erb',
// Make sure this is last so it gets the chance to override other configs.
// See https://github.com/prettier/eslint-config-prettier and https://github.com/prettier/eslint-plugin-prettier
'plugin:prettier/recommended',
],

rules: {
// Some rules in this following shared region are not applied since they are overridden in subsequent regions
// #region shared with https://github.com/paranext/paranext-core/blob/main/.eslintrc.js except certain overrides

// #region ERB rules

// Use `noImplicitReturns` instead. See https://typescript-eslint.io/rules/consistent-return/.
'consistent-return': 'off',
'import/extensions': 'off',
// A temporary hack related to IDE not resolving correct package.json
'import/no-extraneous-dependencies': 'off',
'import/no-import-module-exports': 'off',
'import/no-unresolved': 'error',
'react/jsx-filename-extension': 'off',
'react/react-in-jsx-scope': 'off',

// #endregion

// #region Platform.Bible rules

// Rules in each section are generally in alphabetical order. However, several
// `@typescript-eslint` rules require disabling the equivalent ESLint rule. So in these cases
// each ESLint rule is turned off immediately above the corresponding `@typescript-eslint` rule.
'class-methods-use-this': 'off',
'@typescript-eslint/class-methods-use-this': [
'error',
{ ignoreOverrideMethods: true, ignoreClassesThatImplementAnInterface: false },
],
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': [
'error',
'always',
{ exceptAfterSingleLine: true, exceptAfterOverload: true },
],
'@typescript-eslint/member-ordering': 'error',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': [
'error',
{
allow: ['arrowFunctions', 'functions', 'methods'],
},
],
'@typescript-eslint/no-explicit-any': 'error',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['shared/*', 'renderer/*', 'extension-host/*', 'node/*', 'client/*', 'main/*'],
message: `Importing from this path is not allowed. Try importing from @papi/core. Imports from paths like 'shared', 'renderer', 'node', 'client' and 'main' are not allowed to prevent unnecessary import break.`,
},
],
},
],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, allowNamedExports: true, typedefs: false, ignoreTypeReferences: true },
],
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
'comma-dangle': ['error', 'always-multiline'],
'import/no-anonymous-default-export': ['error', { allowCallExpression: false }],
indent: 'off',
'jsx-a11y/label-has-associated-control': [
'error',
{
assert: 'either',
},
],
// Should use our logger anytime you want logs that persist. Otherwise use console only in testing
'no-console': 'warn',
'no-null/no-null': 2,
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-type-assertion/no-type-assertion': 'error',
'prettier/prettier': ['warn', { tabWidth: 2, trailingComma: 'all' }],
'react/jsx-indent-props': ['warn', 2],
'react/jsx-props-no-spreading': ['error', { custom: 'ignore' }],
'react/require-default-props': 'off',

// #endregion

// #endregion

// #region Overrides to rules from paranext-core

'import/no-unresolved': ['error', { ignore: ['@papi'] }],

// #endregion
},
globals: {
globalThis: 'readonly',
},
overrides: [
{
// Allow this file to have overrides to rules from paranext-core
files: ['.eslintrc.*js'],
rules: {
'no-dupe-keys': 'off',
},
},
{
files: ['*.js'],
rules: {
strict: 'off',
},
},
{
// Don't require extensions to have a default export for "activate()"
files: ['*.ts'],
rules: {
'import/prefer-default-export': 'off',
},
},
{
files: ['./lib/*', './webpack/*'],
rules: {
// These files are scripts not running in Platform.Bible, so they can't use the logger
'no-console': 'off',
},
},
{
files: ['*.d.ts'],
rules: {
// Allow .d.ts files to self import so they can refer to their types in `papi-shared-types`
'import/no-self-import': 'off',
},
},
],
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
project: './tsconfig.lint.json',
tsconfigRootDir: __dirname,
createDefaultProgram: true,
},
plugins: ['@typescript-eslint', 'no-type-assertion', 'no-null'],
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
};

// #endregion
33 changes: 33 additions & 0 deletions extensions/src/platform-get-resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# #region shared with https://github.com/paranext/paranext-multi-extension-template/blob/main/.gitignore

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
release
dist-ssr
*.local

# formatting and linting
.eslintcache

# Editor directories and files
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Temporary intermediate build files
temp-build

# #endregion
Loading
Loading