mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-09 17:39:35 +00:00
little fixes and for Android ui hotfix
This commit is contained in:
1 parent
ff64c035e6
commit
8c9ad287eb
4 files changed
+38
-11
No files matched your search
@@ -37,11 +37,23 @@ impl YomitanDatabase {
|
|||||||
) -> Result<Vec<YomitanRow>, CJDicError> {
|
) -> Result<Vec<YomitanRow>, CJDicError> {
|
||||||
let and_or = if q_term == q_reading { "OR" } else { "AND" };
|
let and_or = if q_term == q_reading { "OR" } else { "AND" };
|
||||||
|
|
||||||
let q_term_norm = if q_term.ends_with("*") {
|
let mut new_t = String::new();
|
||||||
normalize_term(&q_term[..q_term.len() - 1]) + "*"
|
let mut new_seg = String::new();
|
||||||
} else {
|
|
||||||
normalize_term(q_term)
|
for c in q_term.chars() {
|
||||||
};
|
match c {
|
||||||
|
'*' | '?' | '[' | ']' | '\\' => {
|
||||||
|
new_t.push_str(&normalize_term(&new_seg));
|
||||||
|
new_seg.clear();
|
||||||
|
new_t.push(c)
|
||||||
|
}
|
||||||
|
_ => new_seg.push(c),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new_t.push_str(&normalize_term(&new_seg));
|
||||||
|
|
||||||
|
let q_term_norm = new_t;
|
||||||
|
|
||||||
// TODO: consider using = if not GLOB string
|
// TODO: consider using = if not GLOB string
|
||||||
let sql = format!(
|
let sql = format!(
|
||||||
|
|||||||
@@ -32,3 +32,9 @@ span {
|
|||||||
background-color: #0f0f0f69;
|
background-color: #0f0f0f69;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (width < 1000px) {
|
||||||
|
body {
|
||||||
|
padding-top: 2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@ function LoadingDialog() {
|
|||||||
if (payload.new_dicts.length > 0) {
|
if (payload.new_dicts.length > 0) {
|
||||||
messages = [
|
messages = [
|
||||||
...messages,
|
...messages,
|
||||||
{ message: `Loading:` },
|
{ message: "Importing Yomitan zip in resources/ folder:" },
|
||||||
...payload.new_dicts.map((d) => ({ message: `- ${d}` })),
|
...payload.new_dicts.map((d) => ({ message: `- ${d}` })),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ function LoadingDialog() {
|
|||||||
if (payload.to_be_removed_dicts.length > 0) {
|
if (payload.to_be_removed_dicts.length > 0) {
|
||||||
messages = [
|
messages = [
|
||||||
...messages,
|
...messages,
|
||||||
{ message: `Removing:` },
|
{ message: "Removing Yomitan zip:" },
|
||||||
...payload.to_be_removed_dicts.map((d) => ({ message: `- ${d}` })),
|
...payload.to_be_removed_dicts.map((d) => ({ message: `- ${d}` })),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ function LoadingDialog() {
|
|||||||
? messages.map((m, i) => (
|
? messages.map((m, i) => (
|
||||||
<p key={i}>
|
<p key={i}>
|
||||||
{m.total
|
{m.total
|
||||||
? `${m.message} (${m.current} / ${m.total})`
|
? `${m.message} (${m.current}/${m.total})`
|
||||||
: m.message}
|
: m.message}
|
||||||
</p>
|
</p>
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ pub async fn init_yomitan(
|
|||||||
let zip_dir = app
|
let zip_dir = app
|
||||||
.path()
|
.path()
|
||||||
.resolve("resources/yomitan", BaseDirectory::Resource)
|
.resolve("resources/yomitan", BaseDirectory::Resource)
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| {
|
||||||
|
eprintln!("{:?}", e);
|
||||||
|
e.to_string()
|
||||||
|
})?;
|
||||||
// println!("{:?}", zip_dir.as_path());
|
// println!("{:?}", zip_dir.as_path());
|
||||||
|
|
||||||
state
|
state
|
||||||
@@ -24,7 +27,10 @@ pub async fn init_yomitan(
|
|||||||
app.emit("yomitan-import-progress", r).unwrap();
|
app.emit("yomitan-import-progress", r).unwrap();
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| {
|
||||||
|
eprintln!("{:?}", e);
|
||||||
|
e.to_string()
|
||||||
|
})?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -39,5 +45,8 @@ pub async fn search_yomitan(
|
|||||||
) -> Result<Vec<YomitanRow>, String> {
|
) -> Result<Vec<YomitanRow>, String> {
|
||||||
state
|
state
|
||||||
.search_yomitan(q_term, q_reading, limit, offset)
|
.search_yomitan(q_term, q_reading, limit, offset)
|
||||||
.map_err(|e| e.to_string())
|
.map_err(|e| {
|
||||||
|
eprintln!("{:?}", e);
|
||||||
|
e.to_string()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user