Skip to content

Commit 95400eb

Browse files
committed
wip
1 parent 7c063fa commit 95400eb

File tree

2 files changed

+57
-37
lines changed

2 files changed

+57
-37
lines changed

flake.nix

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,52 @@
1212
};
1313
};
1414

15-
outputs = { nixpkgs, flake-utils, fenix, /* unstable, */ ... }:
16-
flake-utils.lib.eachDefaultSystem (system:
17-
let
18-
pkgs = nixpkgs.legacyPackages.${system};
19-
# unstable-pkgs = unstable.legacyPackages.${system};
20-
rust-toolchain = import ./nix/rust-toolchain.nix { inherit fenix system; };
15+
outputs = {
16+
nixpkgs,
17+
flake-utils,
18+
fenix,
19+
/*
20+
unstable,
21+
*/
22+
...
23+
}:
24+
flake-utils.lib.eachDefaultSystem (system: let
25+
pkgs = nixpkgs.legacyPackages.${system};
26+
# unstable-pkgs = unstable.legacyPackages.${system};
27+
rust-toolchain = import ./nix/rust-toolchain.nix {inherit fenix system;};
2128

22-
common = {
23-
buildInputs = with pkgs; [
24-
gnumake
25-
bun
26-
biome
27-
lefthook
28-
dotenv-cli
29-
prisma
30-
prisma-engines
31-
];
29+
common = {
30+
buildInputs = with pkgs; [
31+
gnumake
32+
bun
33+
biome
34+
lefthook
35+
dotenv-cli
36+
prisma
37+
prisma-engines
38+
];
3239

33-
shellHook = with pkgs; ''
34-
# requird by prisma
35-
export PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine";
36-
export PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node";
37-
export PRISMA_INTROSPECTION_ENGINE_BINARY="${prisma-engines}/bin/introspection-engine";
38-
export PRISMA_FMT_BINARY="${prisma-engines}/bin/prisma-fmt";
40+
shellHook = with pkgs; ''
41+
# requird by prisma
42+
export PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine";
43+
export PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node";
44+
export PRISMA_INTROSPECTION_ENGINE_BINARY="${prisma-engines}/bin/introspection-engine";
45+
export PRISMA_FMT_BINARY="${prisma-engines}/bin/prisma-fmt";
3946
40-
export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib
41-
'';
42-
};
43-
in
44-
{
45-
devShells.default = pkgs.mkShell common;
46-
devShells.scraper = pkgs.mkShell {
47-
buildInputs = common.buildInputs ++ [
47+
# export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib
48+
'';
49+
};
50+
in {
51+
devShells.default = pkgs.mkShell common;
52+
devShells.scraper = pkgs.mkShell {
53+
buildInputs =
54+
common.buildInputs
55+
++ [
4856
pkgs.pkg-config
4957
pkgs.openssl
5058
rust-toolchain
5159
];
52-
shellHook = common.shellHook;
53-
};
54-
});
60+
shellHook = common.shellHook;
61+
};
62+
});
5563
}
56-

web/components/search/table.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use client";
2-
import { useMemo } from "react";
2+
import { useMemo, useState } from "react";
33
import request from "~/api/request";
44
import { useAll, useMatched, useMyID, usePendingFromMe } from "~/api/user";
55
import { useModal } from "../common/modal/ModalProvider";
@@ -30,14 +30,27 @@ export default function UserTable({ query }: { query: string }) {
3030
state: { data: pending },
3131
} = usePendingFromMe();
3232

33-
// ユーザーがリクエストを送ってない人だけリストアップする
33+
// リクエストを送ってない人のみリクエスト送信可能
34+
// FIXME: O(n^2) | n = count(users) なのでめっちゃ計算コストかかる。なんとかして。
3435
const canRequest = (userId: number) =>
3536
!matches?.some((match) => match.id === userId) &&
3637
!pending?.some((pending) => pending.id === userId);
3738

39+
// const [searchQuery__interest, setSearchQuery__interest] = useState<string | null>(null);
40+
const searchQuery__interest = "hello";
41+
42+
const filteredUsers = users
43+
// this is O(count(users) * count(avg(count(interests))) * count(avg(len(interests.name)))). very bad.
44+
?.filter(
45+
(u) =>
46+
searchQuery__interest === null ||
47+
u.interestSubjects.some((i) => i.name.includes(searchQuery__interest)),
48+
);
49+
console.log(searchQuery__interest);
50+
3851
return (
3952
<div>
40-
{users?.map((user) => (
53+
{filteredUsers?.map((user) => (
4154
<HumanListItem
4255
key={user.id}
4356
id={user.id}

0 commit comments

Comments
 (0)