Compare commits

..

No commits in common. "c1ab31054cdd212b90b547592f604907ea4f6bd7" and "dac40537bf904a9636f6d0b5437931d1fc95027f" have entirely different histories.

9 changed files with 12 additions and 219 deletions

6
.envrc
View file

@ -1,4 +1,4 @@
export HOUHOU_SRC=$PWD
export DATABASE_URL=$HOUHOU_SRC/src-tauri/SrsDatabase.sqlite
strict_env
use flake
export HOUHOU_SRC=$PWD
export DATABASE_URL=$HOUHOU_SRC/src-tauri/SrsDatabase.sqlite

3
.gitignore vendored
View file

@ -24,5 +24,4 @@ dist-ssr
*.sw?
houhou.db
src/data/kanadata.json
.direnv
src/data/kanadata.json

View file

@ -1,112 +0,0 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1686464419,
"narHash": "sha256-2hnB1rRENavNQRmroJqRJlAXJxaUxFuNKxWTHtXBUlE=",
"owner": "nix-community",
"repo": "fenix",
"rev": "f7169edb93ce396ff1f0d94620241c6390f49f54",
"type": "github"
},
"original": {
"id": "fenix",
"type": "indirect"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1686412476,
"narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "21951114383770f96ae528d0ae68824557768e81",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1686544600,
"narHash": "sha256-QRSZuGex5W+41zqm7NHXcokkgev8WULS8xGyQEpMXtI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c1944ee51b8d6885aaa5470fbb010b86c01d6470",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"fenix": "fenix",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1686406537,
"narHash": "sha256-dLR+WVwKTwmzCVx0N91BkILXhNPlZ3uuUVg6GFvusME=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "68bdf609f37a74547d9fbdf28ed22c10f9bcca45",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,62 +0,0 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, fenix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ fenix.overlays.default ];
};
toolchain = pkgs.fenix.stable;
libraries = with pkgs; [
webkitgtk
gtk3
cairo
gdk-pixbuf
glib.out
dbus.lib
openssl.out
libayatana-appindicator
];
packages = with pkgs; [
pkg-config
dbus
openssl
glib
gtk3
libsoup
webkitgtk
appimagekit
];
in {
devShell = pkgs.mkShell {
buildInputs = packages;
packages = (with pkgs; [ ]) ++ (with toolchain; [
rustc
cargo
# rust-analyzer
# rust-src
# rust-std
# Get the nightly version of rustfmt so we can wrap comments
pkgs.fenix.default.rustfmt
]);
shellHook = let
joinLibs = libs:
builtins.concatStringsSep ":" (builtins.map (x: "${x}/lib") libs);
libs = joinLibs libraries;
in ''
export LD_LIBRARY_PATH=${libs}:$LD_LIBRARY_PATH
'';
};
});
}

View file

@ -26,7 +26,7 @@ use crate::srs::SrsDb;
#[tokio::main]
async fn main() -> Result<()> {
let app_dir = dirs::state_dir().unwrap().join("houhou");
let app_dir = dirs::config_dir().unwrap().join("houhou");
fs::create_dir_all(&app_dir).await?;
// Open kanji db
@ -60,15 +60,6 @@ async fn main() -> Result<()> {
.manage(KanjiDb(kanji_pool))
.manage(SrsDb(srs_pool))
.system_tray(tray)
.setup(|app| {
let resource_path = app
.path_resolver()
.resolve_resource("./KanjiDatabase.sqlite")
.expect("failed to resolve resource");
println!("Resource path: {}", resource_path.display());
Ok(())
})
.invoke_handler(tauri::generate_handler![
srs::get_srs_stats,
srs::add_srs_item,

View file

@ -31,9 +31,6 @@
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [
"./KanjiDatabase.sqlite"
]
},
"security": {
@ -53,4 +50,4 @@
}
]
}
}
}

View file

@ -1,10 +1,5 @@
@use "sass:color";
$navLinkAccentColor: #09c;
$navLinkColor: hsl(203, 91%, 91%);
$navLinkTransparent: hsla(203, 91%, 91%, 0%);
$grayed: #f4f4f4;
$grayedTransparent: #f4f4f400;
.main {
min-height: 0;
@ -39,7 +34,7 @@ $grayedTransparent: #f4f4f400;
text-align: center;
padding: 12px;
border-top: 4px solid transparent;
transition: background 0.1s ease-out, border-top-color 0.1s ease-out;
transition: background-color 0.1s ease-out, border-top-color 0.1s ease-out;
// Make the top bar seem less web-ish
user-select: none;
@ -48,17 +43,12 @@ $grayedTransparent: #f4f4f400;
&:not(.link-active):hover {
border-top-color: #f4f4f4;
background: -moz-linear-gradient(180deg, $grayed 0%, $grayedTransparent 100%);
background: -webkit-linear-gradient(180deg, $grayed 0%, $grayedTransparent 100%);
background: linear-gradient(180deg, $grayed 0%, $grayedTransparent 100%);
background: linear-gradient(#f4f4f4, transparent);
}
}
.link-active {
border-top-color: $navLinkAccentColor;
// background-color: $navLinkColor;
background: $navLinkColor;
background: -moz-linear-gradient(180deg, $navLinkColor 0%, $navLinkTransparent 100%);
background: -webkit-linear-gradient(180deg, $navLinkColor 0%, $navLinkTransparent 100%);
background: linear-gradient(180deg, $navLinkColor 0%, $navLinkTransparent 100%);
background: linear-gradient($navLinkColor, transparent);
}

View file

@ -5,8 +5,7 @@ import useSWR from "swr";
import { invoke } from "@tauri-apps/api/tauri";
import { Link } from "react-router-dom";
import ConditionalWrapper from "./utils/ConditionalWrapper";
import ReactTimeago, { Formatter } from "react-timeago";
import { isValid } from "date-fns";
import ReactTimeago from "react-timeago";
interface SrsStats {
reviews_available: number;
@ -47,15 +46,7 @@ export default function DashboardReviewStats() {
const canReview = srsStats.reviews_available == 0;
const nextReviewDate = new Date(srsStats.next_review * 1_000);
const nowFormatter: Formatter = (value, unit, suffix, epochMilliseconds, nextFormatter) => {
if (epochMilliseconds < Date.now()) return "now";
return nextFormatter?.(value, unit, suffix, epochMilliseconds);
};
const nextReview = srsStats.next_review ? (
<ReactTimeago date={nextReviewDate} formatter={nowFormatter} />
) : (
"never"
);
const nextReview = <ReactTimeago date={nextReviewDate} />;
const generateStat = (stat: Stat) => {
return (
@ -92,7 +83,7 @@ export default function DashboardReviewStats() {
)}
elseWrapper={(children) => <Link to="/srs/review">{children}</Link>}
>
<Button isDisabled={canReview} cursor="pointer" colorScheme="blue">
<Button isDisabled={canReview} colorScheme="blue">
Start reviewing <ArrowRightIcon marginLeft={3} />
</Button>
</ConditionalWrapper>

View file

@ -35,7 +35,6 @@ $kanjiCharacterSize: 28px;
.kanji-list-scroll {
direction: rtl;
overflow-y: scroll;
overscroll-behavior-y: none;
}
.kanji-list-inner {