-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
72 lines (63 loc) · 2.02 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import type {
Organization,
Position,
Achievement,
Failure,
Project,
Challenge,
OrganizationStates,
} from "@prisma/client";
import type {
ACClient,
SessionManager,
UserType,
} from "@kinde-oss/kinde-typescript-sdk";
import * as b from "~/utils/button";
import * as benchmarks from "~/constants/benchmarks";
import type { loadPosition, loadPositionBenchmarks } from "./server/utils/db";
export type AuthState =
| { loggedIn: true; user: UserType }
| { loggedIn: false; user: null };
type Slice<T extends Array<unknown>> = T extends [infer _A, ...infer B]
? B
: never;
export type KindeContext = {
[key in keyof ACClient]: (
...args: Slice<Parameters<ACClient[key]>>
) => ReturnType<ACClient[key]>;
} & { sessionManager: SessionManager };
export type KindeAccessToken = {
access_token: string;
expires_in: number;
token_type: string;
};
export type Orgs = Pick<Organization, "name" | "slug">[];
export type SingleOrg = NonNullable<Awaited<ReturnType<typeof loadOrg>>>;
export type SinglePos = NonNullable<Awaited<ReturnType<typeof loadPosition>>>;
export type Benchmarks = NonNullable<
Awaited<ReturnType<typeof loadPositionBenchmarks>>
>;
export type ApiFetchedOrgs = Orgs[number] | null | undefined;
export type OrgPos = Pick<
Position,
"title" | "slug" | "monthStartedAt" | "yearStartedAt"
>[];
export type OrgStates = Omit<OrganizationStates, "id">;
export interface ButtonVariants {
variant?: NonNullable<Parameters<typeof b.variants>[0]>["variant"];
size?: NonNullable<Parameters<typeof b.variants>[0]>["size"];
}
export type Benchmark = (typeof benchmarks)[keyof typeof benchmarks];
export type BenchmarkPayload =
| Omit<Achievement | Failure, "id" | "positionId">
| Omit<Project, "id" | "positionId">
| Omit<Challenge, "id" | "positionId">;
export type BenchmarkState = {
shouldRefresh: Ref<boolean>;
update: () => void;
};
export type ProvidedBenchmarks = {
data: Ref<Benchmarks>;
getResourceIndex: (slug: string) => number | undefined;
deleteBenchmark: (slug: string) => void;
};