Merge branch 'messages_overhaul' into staging_environment

This commit is contained in:
Carter 2026-02-26 11:31:29 -06:00
commit 4871100365
15 changed files with 339 additions and 106 deletions

View file

@ -1,7 +1,7 @@
import { AxiosResponse } from "axios";
import { useHTTP } from "hooks";
import { pond } from "protobuf-ts/pond";
import { useGlobalState } from "providers";
// import { useGlobalState } from "providers";
import { createContext, PropsWithChildren, useContext } from "react";
import { pondURL } from "./pond";
@ -37,7 +37,7 @@ interface Props {}
export default function NoteProvider(props: PropsWithChildren<Props>) {
const { children } = props;
const { get, del, post, put } = useHTTP();
const [{as}] = useGlobalState()
// const [{as}] = useGlobalState()
const addNote = (note: pond.NoteSettings, attachments?: string[]) => {
let url = pondURL("/notes" + (attachments ? "?attachments=" + attachments.toString() : ""))
@ -88,9 +88,9 @@ export default function NoteProvider(props: PropsWithChildren<Props>) {
orderBy?: string,
search?: string,
asRoot?: boolean,
otherTeam?: string
// otherTeam?: string
) => {
const view = otherTeam ? otherTeam : as
// const view = otherTeam ? otherTeam : as
let url = pondURL(
"/notes" +
"?limit=" +
@ -100,9 +100,10 @@ export default function NoteProvider(props: PropsWithChildren<Props>) {
("&order=" + (order ? order : "asc")) +
("&by=" + (orderBy ? orderBy : "key")) +
(search ? "&search=" + search : "") +
(asRoot ? "&asRoot=" + asRoot.toString() : "") +
(view ? "&as=" + view : "")
(asRoot ? "&asRoot=" + asRoot.toString() : ""),
// (view ? "&as=" + "" : "")
)
// console.log(url)
return new Promise<AxiosResponse<pond.ListNotesResponse>>((resolve, reject) => {
get<pond.ListNotesResponse>(url).then(resp => {
resp.data = pond.ListNotesResponse.fromObject(resp.data)
@ -119,10 +120,10 @@ export default function NoteProvider(props: PropsWithChildren<Props>) {
order?: "asc" | "desc",
orderBy?: string,
search?: string,
asRoot?: boolean,
otherTeam?: string
// asRoot?: boolean,
// otherTeam?: string
) => {
const view = otherTeam ? otherTeam : as
// const view = otherTeam ? otherTeam : as
let url = pondURL(
"/chats" +
"?limit=" +
@ -131,10 +132,11 @@ export default function NoteProvider(props: PropsWithChildren<Props>) {
offset +
("&order=" + (order ? order : "asc")) +
("&by=" + (orderBy ? orderBy : "key")) +
(search ? "&search=" + search : "") +
(asRoot ? "&asRoot=" + asRoot.toString() : "") +
(view ? "&as=" + view : "")
(search ? "&search=" + search : ""),
// (asRoot ? "&asRoot=" + asRoot.toString() : ""),
// (view ? "&as=" + view : "")
)
// console.log(asRoot)
return new Promise<AxiosResponse<pond.ListChatsResponse>>((resolve, reject) => {
get<pond.ListChatsResponse>(url).then(resp => {
resp.data = pond.ListChatsResponse.fromObject(resp.data)

View file

@ -117,9 +117,11 @@ export default function TeamProvider(props: PropsWithChildren<Props>) {
asRoot?: boolean,
otherTeam?: string,
prefixSearch?: string,
useImitation?: boolean,
) => {
//let asText = team ? "&as=" + team.key() : "";
const view = otherTeam ? otherTeam : (as.length > 0 ? as : undefined)
let view = otherTeam ? otherTeam : (as.length > 0 ? as : undefined)
if (useImitation === undefined || useImitation === false) view = ""
let url = pondURL(
"/teams" +
"?limit=" +