Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adminforth/i18n

Package Overview
Dependencies
Maintainers
0
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adminforth/i18n - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

24

dist/index.js

@@ -134,3 +134,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

// add virtual field for incomplete
resourceConfig.columns.push({
resourceConfig.columns.unshift({
name: 'fully_translated',

@@ -261,2 +261,24 @@ label: 'Fully translated',

;
// if there is menu item with resourceId, add .badge function showing number of untranslated strings
const addBadgeCountToMenuItem = (menuItem) => {
console.log('🪲menuItem, registring ', menuItem);
menuItem.badge = () => __awaiter(this, void 0, void 0, function* () {
const resource = adminforth.resource(menuItem.resourceId);
const count = yield resource.count([Filters.NEQ(this.options.completedFieldName, this.fullCompleatedFieldValue)]);
return `${count}`;
});
menuItem.badgeTooltip = 'Untranslated count';
};
adminforth.config.menu.forEach((menuItem) => {
if (menuItem.resourceId === resourceConfig.resourceId) {
addBadgeCountToMenuItem(menuItem);
}
if (menuItem.children) {
menuItem.children.forEach((child) => {
if (child.resourceId === resourceConfig.resourceId) {
addBadgeCountToMenuItem(child);
}
});
}
});
});

@@ -263,0 +285,0 @@ }

import AdminForth, { AdminForthPlugin, Filters, suggestIfTypo, AdminForthDataTypes } from "adminforth";
import type { IAdminForth, IHttpServer, AdminForthComponentDeclaration, AdminForthResourceColumn, AdminForthResource, BeforeLoginConfirmationFunction } from "adminforth";
import type { IAdminForth, IHttpServer, AdminForthComponentDeclaration, AdminForthResourceColumn, AdminForthResource, BeforeLoginConfirmationFunction, AdminForthConfigMenuItem } from "adminforth";
import type { PluginOptions } from './types.js';

@@ -150,3 +150,3 @@ import iso6391, { LanguageCode } from 'iso-639-1';

// add virtual field for incomplete
resourceConfig.columns.push({
resourceConfig.columns.unshift({
name: 'fully_translated',

@@ -298,2 +298,27 @@ label: 'Fully translated',

};
// if there is menu item with resourceId, add .badge function showing number of untranslated strings
const addBadgeCountToMenuItem = (menuItem: AdminForthConfigMenuItem) => {
console.log('🪲menuItem, registring ', menuItem);
menuItem.badge = async () => {
const resource = adminforth.resource(menuItem.resourceId);
const count = await resource.count([Filters.NEQ(this.options.completedFieldName, this.fullCompleatedFieldValue)]);
return `${count}`;
};
menuItem.badgeTooltip = 'Untranslated count';
}
adminforth.config.menu.forEach((menuItem) => {
if (menuItem.resourceId === resourceConfig.resourceId) {
addBadgeCountToMenuItem(menuItem);
}
if (menuItem.children) {
menuItem.children.forEach((child) => {
if (child.resourceId === resourceConfig.resourceId) {
addBadgeCountToMenuItem(child);
}
});
}
});
}

@@ -300,0 +325,0 @@

2

package.json
{
"name": "@adminforth/i18n",
"version": "1.0.4",
"version": "1.0.5",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc