mirror of
https://github.com/wassname/talk.git
synced 2026-07-18 12:40:13 +08:00
* feat: stream sort description to use reaction conf * feat: use full custom translation string for the sort label
32 lines
761 B
TypeScript
32 lines
761 B
TypeScript
import { commitLocalUpdate, Environment } from "relay-runtime";
|
|
|
|
import { createMutationContainer, LOCAL_ID } from "talk-framework/lib/relay";
|
|
|
|
export interface SetStreamOrderByInput {
|
|
orderBy:
|
|
| "CREATED_AT_ASC"
|
|
| "CREATED_AT_DESC"
|
|
| "REPLIES_DESC"
|
|
| "REACTION_DESC"
|
|
| "%future added value";
|
|
}
|
|
|
|
export type SetStreamOrderByMutation = (
|
|
input: SetStreamOrderByInput
|
|
) => Promise<void>;
|
|
|
|
export async function commit(
|
|
environment: Environment,
|
|
input: SetStreamOrderByInput
|
|
) {
|
|
return commitLocalUpdate(environment, store => {
|
|
const record = store.get(LOCAL_ID)!;
|
|
record.setValue(input.orderBy, "streamOrderBy");
|
|
});
|
|
}
|
|
|
|
export const withSetStreamOrderByMutation = createMutationContainer(
|
|
"setStreamOrderBy",
|
|
commit
|
|
);
|