chore: Add language dropdown for localization
- Added a new language dropdown component for localization - Improved spacing and styling across multiple components - Removed unused code and commented out debug lines - Updated dependencies for flag icons and solid-js library.
This commit is contained in:
parent
2b9a2720bc
commit
cbebfa86e7
@ -1,3 +1,5 @@
|
|||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use quickxml_to_serde::{xml_string_to_json, Config, NullValue};
|
use quickxml_to_serde::{xml_string_to_json, Config, NullValue};
|
||||||
use specta::specta;
|
use specta::specta;
|
||||||
|
|
||||||
@ -22,25 +24,27 @@ pub fn download_gamedata(data: &str, endpoint: GamedataEndpoints) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #[specta]
|
#[specta]
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn parse_data(
|
pub fn parse_data(
|
||||||
path: String,
|
path: &str,
|
||||||
file_name: String,
|
file_name: &str,
|
||||||
file_content: String,
|
file_content: &str,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let file_dir = PathBuf::from(&path).join(format!("{}.json", file_name));
|
let file_dir = PathBuf::from(&path).join(format!("{}.json", file_name));
|
||||||
|
|
||||||
|
println!("{:?}", file_dir);
|
||||||
|
|
||||||
// By default, output files will be overwritten. I cannot recursively remove the entire output folder
|
// By default, output files will be overwritten. I cannot recursively remove the entire output folder
|
||||||
// and create it again because it just won't parse files' contents for some reason
|
// and create it again because it just won't parse files' contents for some reason
|
||||||
if !exists(&Convertion::gamedata_dir()) {
|
/* if !exists(&Convertion::gamedata_dir()) {
|
||||||
create_dir_all(&Convertion::gamedata_dir())?;
|
create_dir_all(&Convertion::gamedata_dir())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_file(&file_dir, file_content.as_bytes());
|
write_file(&file_dir, file_content.as_bytes()); */
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
} */
|
}
|
||||||
|
|
||||||
/* pub async fn convert_txt(path: &str, data: &str) -> Result<(), Box<dyn std::error::Error>> {
|
/* pub async fn convert_txt(path: &str, data: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut badges: Vec<Badge> = Vec::new();
|
let mut badges: Vec<Badge> = Vec::new();
|
||||||
|
@ -12,13 +12,14 @@ fn main() {
|
|||||||
ts::export(collect_types![download_gamedata], "../src/tools/rusty.ts").unwrap();
|
ts::export(collect_types![download_gamedata], "../src/tools/rusty.ts").unwrap();
|
||||||
|
|
||||||
// This is useful for custom eslint, prettier overrides at the top of the file.
|
// This is useful for custom eslint, prettier overrides at the top of the file.
|
||||||
// ts::export_with_cfg_with_header(
|
/* ts::export_with_cfg_with_header(
|
||||||
// collect_types![download_gamedata].unwrap(),
|
collect_types![download_gamedata].unwrap(),
|
||||||
// Default::default(),
|
Default::default(),
|
||||||
// "../src/tools/rusty.ts",
|
"../src/tools/rusty.ts",
|
||||||
// "/* eslint-disable */\n".into(),
|
"/* eslint-disable */
|
||||||
// )
|
\n".into(),
|
||||||
// .unwrap();
|
)
|
||||||
|
.unwrap(); */
|
||||||
|
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.invoke_handler(tauri::generate_handler![download_gamedata])
|
.invoke_handler(tauri::generate_handler![download_gamedata])
|
||||||
|
@ -29,11 +29,42 @@ pub struct GamedataEndpoints {
|
|||||||
pub file_name: Converters,
|
pub file_name: Converters,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct FigureData {
|
#[derive(Serialize, Deserialize, Type, Debug)]
|
||||||
|
pub struct FurniData {
|
||||||
pub floor_items: Vec<IFloorItem>,
|
pub floor_items: Vec<IFloorItem>,
|
||||||
pub wall_items: Vec<IFurni>,
|
pub wall_items: Vec<IFurni>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct IFloorItem {}
|
#[derive(Serialize, Deserialize, Type, Debug)]
|
||||||
|
pub struct IFloorItem {
|
||||||
|
dimensions: IFloorItemDimensions,
|
||||||
|
permissions: IFloorItemPermissions,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct IFurni {}
|
#[derive(Serialize, Deserialize, Type, Debug)]
|
||||||
|
pub struct IFloorItemDimensions {
|
||||||
|
x: i32,
|
||||||
|
y: i32,
|
||||||
|
default_direction: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Type, Debug)]
|
||||||
|
pub struct IFloorItemPermissions {
|
||||||
|
can_sit_on: bool,
|
||||||
|
can_lay_on: bool,
|
||||||
|
can_stand_on: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Type, Debug)]
|
||||||
|
pub struct IFurni {
|
||||||
|
id: i32,
|
||||||
|
classname: String,
|
||||||
|
description: Option<String>,
|
||||||
|
name: Option<String>,
|
||||||
|
furni_line: Option<String>,
|
||||||
|
custom_params: Option<String>,
|
||||||
|
adurl: Option<String>,
|
||||||
|
offer_id: Option<i32>,
|
||||||
|
exclude_dynamic: bool,
|
||||||
|
special_type: i32,
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::structs::Converters;
|
use crate::structs::{Converters, FurniData, IFloorItem, IFurni};
|
||||||
|
|
||||||
pub fn debug_typeof<T>(_: &T) {
|
pub fn debug_typeof<T>(_: &T) {
|
||||||
println!("{}", std::any::type_name::<T>())
|
println!("{}", std::any::type_name::<T>())
|
||||||
@ -9,17 +9,46 @@ pub fn debug_typeof<T>(_: &T) {
|
|||||||
pub fn convert_json(data: &str, file_name: Converters) {
|
pub fn convert_json(data: &str, file_name: Converters) {
|
||||||
let object: Value = serde_json::from_str(data).unwrap();
|
let object: Value = serde_json::from_str(data).unwrap();
|
||||||
|
|
||||||
println!("{}", object);
|
|
||||||
|
|
||||||
match file_name {
|
match file_name {
|
||||||
/* Converters::FurniData => {
|
Converters::FurniData => {
|
||||||
for (key, value) in object["wallitemtypes"]["furnitype"].as_object().unwrap() {
|
let mut data = FurniData {
|
||||||
println!("{} {}", key, value);
|
floor_items: Vec::new(),
|
||||||
|
wall_items: Vec::new(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let floor_items_result: Result<_, Vec<IFloorItem>> =
|
||||||
|
Ok(serde_json::from_value::<Vec<IFloorItem>>(
|
||||||
|
object["wallitemtypes"]["furnitype"].clone(),
|
||||||
|
));
|
||||||
|
|
||||||
|
let wall_items_result: Result<_, Vec<IFurni>> = Ok(
|
||||||
|
serde_json::from_value::<Vec<IFurni>>(object["roomitemtypes"]["furnitype"].clone()),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Handle the floor_items_result and wall_items_result appropriately
|
||||||
|
match (floor_items_result, wall_items_result) {
|
||||||
|
(Ok(floor_items), Ok(wall_items)) => {
|
||||||
|
while let Ok(ref value) = wall_items {
|
||||||
|
println!("{:?}", value);
|
||||||
}
|
}
|
||||||
} */
|
while let Ok(ref value) = floor_items {
|
||||||
Converters::FigureData => unimplemented!(),
|
println!("{:?}", value);
|
||||||
Converters::FigureMap => todo!(),
|
}
|
||||||
Converters::EffectMap => todo!(),
|
}
|
||||||
Converters::FurniData => todo!(),
|
(Err(e), _) => {
|
||||||
|
println!("Error deserializing floor items: {:?}", e);
|
||||||
|
}
|
||||||
|
(_, Err(e)) => {
|
||||||
|
println!("Error deserializing wall items: {:?}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// loop through each key value pairs (make sure your handle null exceptions)
|
||||||
|
// parse the data to the global variable above
|
||||||
|
//
|
||||||
|
}
|
||||||
|
Converters::FigureData => {}
|
||||||
|
Converters::FigureMap => {}
|
||||||
|
Converters::EffectMap => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
import type { Component } from 'solid-js'
|
import type { Component } from 'solid-js'
|
||||||
|
|
||||||
import { Downloaders, TitleBar } from './components/layout'
|
import { Downloaders, TitleBar, LangDropdown } from './components/layout'
|
||||||
|
|
||||||
const Main: Component = () => {
|
const Main: Component = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TitleBar />
|
<TitleBar />
|
||||||
|
|
||||||
<main class='relative flex h-full w-screen flex-col items-center justify-center bg-[#242424] py-20'>
|
<main class='relative flex h-full w-screen flex-col items-center justify-center bg-[#242424] py-20 text-white'>
|
||||||
<span class='mb-20 text-white'>I would like to:</span>
|
<span class='mb-20'>I would like to:</span>
|
||||||
|
|
||||||
|
<LangDropdown />
|
||||||
|
|
||||||
<Downloaders />
|
<Downloaders />
|
||||||
</main>
|
</main>
|
||||||
|
@ -50,10 +50,17 @@ export const Downloaders: Component = () => {
|
|||||||
|
|
||||||
<Loader active={loading()} class='mt-10' />
|
<Loader active={loading()} class='mt-10' />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
value='Abort'
|
||||||
|
icon={<Image src='/icons/cross.png' />}
|
||||||
|
class='mt-6 bg-red-600 p-2 px-4 active:opacity-40'
|
||||||
|
handler={() => {}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
value='Close'
|
value='Close'
|
||||||
icon={<Image src='/icons/cross.png' />}
|
icon={<Image src='/icons/cross.png' />}
|
||||||
class={classNames('invisible mt-6 bg-red-600 p-2 px-4 text-white opacity-0 active:opacity-40', {
|
class={classNames('invisible mt-6 bg-red-600 p-2 px-4 opacity-0 active:opacity-40', {
|
||||||
'!visible !opacity-100': !loading()
|
'!visible !opacity-100': !loading()
|
||||||
})}
|
})}
|
||||||
handler={() => {
|
handler={() => {
|
||||||
|
@ -12,7 +12,7 @@ export const Popup: Component<PopupProps> = (props) => {
|
|||||||
return (
|
return (
|
||||||
<AnimateView
|
<AnimateView
|
||||||
animation={Animation.fadeInOut()}
|
animation={Animation.fadeInOut()}
|
||||||
class='absolute left-0 top-0 z-20 flex h-screen w-screen flex-col items-center justify-center bg-black/40 text-white'
|
class='absolute left-0 top-0 z-20 flex h-screen w-screen flex-col items-center justify-center bg-black/40'
|
||||||
condition={props.condition}>
|
condition={props.condition}>
|
||||||
{props.children}
|
{props.children}
|
||||||
</AnimateView>
|
</AnimateView>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
export * from './Downloaders'
|
export * from './Downloaders'
|
||||||
export * from './Popup'
|
export * from './Popup'
|
||||||
export * from './TitleBar'
|
export * from './TitleBar'
|
||||||
|
export * from './LangDropdown'
|
||||||
|
export * from './OutSideEventHandler'
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import type { IEffectMap, IXML } from '../types'
|
import type { IEffectMap } from '../types'
|
||||||
|
|
||||||
export class EffectMap {
|
export class EffectMap {
|
||||||
public data: IEffectMap = {}
|
public data: IEffectMap = {}
|
||||||
public fileName: string
|
public fileName: string
|
||||||
|
|
||||||
constructor(XML: IXML, fileName: string) {
|
constructor(XML: any, fileName: string) {
|
||||||
this.fileName = fileName
|
this.fileName = fileName
|
||||||
|
|
||||||
this.parseLibrairies(XML.map.effect)
|
this.parseLibrairies(XML.map.effect)
|
||||||
|
@ -2,6 +2,8 @@ import { render } from 'solid-js/web'
|
|||||||
|
|
||||||
import './styles/fonts.css'
|
import './styles/fonts.css'
|
||||||
import './styles/styles.css'
|
import './styles/styles.css'
|
||||||
|
import 'flag-icons/css/flag-icons.min.css'
|
||||||
|
|
||||||
import App from './App'
|
import App from './App'
|
||||||
|
|
||||||
render(() => {
|
render(() => {
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
|
|
||||||
@layer components {
|
@layer components {
|
||||||
.download-button {
|
.download-button {
|
||||||
@apply retro-text-shadow center-x-axis center-x-axis -bottom-4 z-10 h-12 w-10/12 border-2 text-xs text-white shadow-2xl transition-all hover:-translate-x-1/2 hover:scale-105 hover:duration-200 active:-translate-x-1/2 active:scale-95 active:opacity-80 active:shadow-none active:duration-75;
|
@apply retro-text-shadow center-x-axis center-x-axis -bottom-4 z-10 h-12 w-10/12 border-2 text-xs shadow-2xl transition-all hover:-translate-x-1/2 hover:scale-105 hover:duration-200 active:-translate-x-1/2 active:scale-95 active:opacity-80 active:shadow-none active:duration-75;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user