mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-08 17:35:18 +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> {
|
||||
let and_or = if q_term == q_reading { "OR" } else { "AND" };
|
||||
|
||||
let q_term_norm = if q_term.ends_with("*") {
|
||||
normalize_term(&q_term[..q_term.len() - 1]) + "*"
|
||||
} else {
|
||||
normalize_term(q_term)
|
||||
};
|
||||
let mut new_t = String::new();
|
||||
let mut new_seg = String::new();
|
||||
|
||||
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
|
||||
let sql = format!(
|
||||
|
||||
@@ -32,3 +32,9 @@ span {
|
||||
background-color: #0f0f0f69;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (width < 1000px) {
|
||||
body {
|
||||
padding-top: 2em;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ function LoadingDialog() {
|
||||
if (payload.new_dicts.length > 0) {
|
||||
messages = [
|
||||
...messages,
|
||||
{ message: `Loading:` },
|
||||
{ message: "Importing Yomitan zip in resources/ folder:" },
|
||||
...payload.new_dicts.map((d) => ({ message: `- ${d}` })),
|
||||
];
|
||||
}
|
||||
@@ -48,7 +48,7 @@ function LoadingDialog() {
|
||||
if (payload.to_be_removed_dicts.length > 0) {
|
||||
messages = [
|
||||
...messages,
|
||||
{ message: `Removing:` },
|
||||
{ message: "Removing Yomitan zip:" },
|
||||
...payload.to_be_removed_dicts.map((d) => ({ message: `- ${d}` })),
|
||||
];
|
||||
}
|
||||
@@ -90,7 +90,7 @@ function LoadingDialog() {
|
||||
? messages.map((m, i) => (
|
||||
<p key={i}>
|
||||
{m.total
|
||||
? `${m.message} (${m.current} / ${m.total})`
|
||||
? `${m.message} (${m.current}/${m.total})`
|
||||
: m.message}
|
||||
</p>
|
||||
))
|
||||
|
||||
@@ -10,7 +10,10 @@ pub async fn init_yomitan(
|
||||
let zip_dir = app
|
||||
.path()
|
||||
.resolve("resources/yomitan", BaseDirectory::Resource)
|
||||
.map_err(|e| e.to_string())?;
|
||||
.map_err(|e| {
|
||||
eprintln!("{:?}", e);
|
||||
e.to_string()
|
||||
})?;
|
||||
// println!("{:?}", zip_dir.as_path());
|
||||
|
||||
state
|
||||
@@ -24,7 +27,10 @@ pub async fn init_yomitan(
|
||||
app.emit("yomitan-import-progress", r).unwrap();
|
||||
},
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
.map_err(|e| {
|
||||
eprintln!("{:?}", e);
|
||||
e.to_string()
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -39,5 +45,8 @@ pub async fn search_yomitan(
|
||||
) -> Result<Vec<YomitanRow>, String> {
|
||||
state
|
||||
.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