Files
random-web-tools/src/stores/toolsStore.js
2024-10-23 19:21:21 +03:00

79 lines
2.3 KiB
JavaScript

import { defineStore } from "pinia";
function sortMenuRoutes(routes) {
const sortedRoutes = {};
const sortedKeys = Object.keys(routes).sort();
for (const key of sortedKeys) {
const innerRoutes = routes[key];
const sortedInnerKeys = Object.keys(innerRoutes).sort();
sortedRoutes[key] = {};
for (const innerKey of sortedInnerKeys) {
sortedRoutes[key][innerKey] = innerRoutes[innerKey];
}
}
return sortedRoutes;
}
export const useToolsStore = defineStore("tools", {
state: () => ({
tools: sortMenuRoutes({
"-": {
table_to_markdown_table: "Table to Markdown table",
table_to_mediawiki_table: "Table to Mediawiki table",
humans_txt: "humans.txt generator",
"%_of_number": "% of number",
},
Docker: {
docker_rename_volume: "Rename volume",
},
GO: {
go_json_to_struct: "JSON to Go struct",
// 'sql_tables_to_struct': 'SQL tables Go struct',
},
JSON: {
json_minifier: "JSON minifier",
json_formatter: "JSON formatter",
},
PHP: {
str_to_php_array: "Str to PHP array",
php_array_to_json: "PHP array to Json",
php_serialize: "PHP serialize",
},
SQL: {
sql_formatter: "SQL formatter",
sql_split_in: "SQL split IN",
},
Strings: {
fix_ru_en_keyboard: "Fix ru-en keyboard",
str_length: "Str length",
str_sort_lines: "Str sort lines",
str_to_lower_upper: "Str to lower/upper",
str_remove_duplicate_lines: "Str remove duplicate lines",
str_pad: "Str pad",
str_numeronym: "Str numeronym (i18n)",
str_to_nato_alphabet: "Str to NATO alphabet",
url_encode_decode: "URL encode/decode",
url_query_viewer: "URL query viewer",
},
Unix: {
explain_crontab: "Explain crontab",
file_base64_encode_decode: "File base64 encode/decode",
unix_timestamp: "Unix timestamp",
sed_generator: "Sed generator",
htaccess_generator: ".htaccess generator",
},
Generators: {
qr_code: "QR code",
iban_generator: "IBAN generator",
dummy_image: "Dummy image",
},
}),
actions: {
// You can add actions here if needed, e.g., to update the tools
},
}),
});