mirror of
https://github.com/balzack/databag.git
synced 2025-04-21 00:55:16 +00:00
preparing to pull topics
This commit is contained in:
parent
34eceaa533
commit
e2e115b80d
@ -26,7 +26,7 @@ function App() {
|
||||
<Route path="/user" element={ <User /> }>
|
||||
<Route path="profile" element={<Profile />} />
|
||||
<Route path="contact/:guid" element={<Contact />} />
|
||||
<Route path="conversation/:contact/:channel" element={<Conversation />} />
|
||||
<Route path="conversation/:card/:channel" element={<Conversation />} />
|
||||
<Route path="conversation/:channel" element={<Conversation />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
|
@ -228,7 +228,7 @@ export function useAppContext() {
|
||||
updateData({ channels: merged });
|
||||
}
|
||||
|
||||
const getCard = (guid) => {
|
||||
const getCardByGuid = (guid) => {
|
||||
let card = null;
|
||||
cards.current.forEach((value, key, map) => {
|
||||
if(value?.data?.cardProfile?.guid == guid) {
|
||||
@ -278,7 +278,8 @@ export function useAppContext() {
|
||||
getRegistry: async (node) => getListing(node),
|
||||
getRegistryImageUrl: (server, guid, revision) => getListingImageUrl(server, guid, revision),
|
||||
getCardImageUrl: (cardId, revision) => getCardImageUrl(state.token, cardId, revision),
|
||||
getCard: getCard,
|
||||
getCardByGuid: getCardByGuid,
|
||||
getCard: (id) => cards.current.get(id),
|
||||
getConnectedCards: getConnectedCards,
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ export function useAddTopic() {
|
||||
busy: false,
|
||||
});
|
||||
|
||||
const { contact, channel } = useParams();
|
||||
const { card, channel } = useParams();
|
||||
const app = useContext(AppContext);
|
||||
|
||||
const updateState = (value) => {
|
||||
@ -56,9 +56,9 @@ export function useAddTopic() {
|
||||
try {
|
||||
let message = { text: state.messageText, textColor: state.messageColor,
|
||||
textSize: state.messageSize, backgroundColor: state.backgroundColor };
|
||||
if (contact) {
|
||||
let card = app.actions.getCard(contact);
|
||||
let token = contact + '.' + card?.data?.cardDetail?.token;
|
||||
if (card) {
|
||||
let contact = app.actions.getCard(card);
|
||||
let token = contact?.data?.cardProfile?.guid + '.' + contact?.data?.cardDetail?.token;
|
||||
await addContactChannelTopic(token, channel, message, []);
|
||||
}
|
||||
else {
|
||||
|
@ -15,10 +15,10 @@ export function ChannelLabel({ item }) {
|
||||
|
||||
let contacts = [];
|
||||
if (item?.guid) {
|
||||
setHost(actions.getCard(item.guid));
|
||||
setHost(actions.getCardByGuid(item.guid));
|
||||
for (let member of item.channel.data.channelDetail.members) {
|
||||
if (member != state.guid) {
|
||||
contacts.push(actions.getCard(member));
|
||||
contacts.push(actions.getCardByGuid(member));
|
||||
}
|
||||
}
|
||||
setMembers(contacts);
|
||||
@ -26,7 +26,7 @@ export function ChannelLabel({ item }) {
|
||||
else {
|
||||
setHost(null);
|
||||
for (let member of item.channel.data.channelDetail.members) {
|
||||
contacts.push(actions.getCard(member));
|
||||
contacts.push(actions.getCardByGuid(member));
|
||||
}
|
||||
setMembers(contacts);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ export function useChannelLabel() {
|
||||
const app = useContext(AppContext);
|
||||
|
||||
const actions = {
|
||||
getCard: app?.actions?.getCard,
|
||||
getCardByGuid: app?.actions?.getCardByGuid,
|
||||
};
|
||||
|
||||
const updateState = (value) => {
|
||||
|
@ -15,11 +15,11 @@ export function ChannelLogo({ item }) {
|
||||
|
||||
if (item?.guid) {
|
||||
setHome(false);
|
||||
setHost(actions.getCard(item.guid));
|
||||
setHost(actions.getCardByGuid(item.guid));
|
||||
let contacts = [];
|
||||
for (let member of item.channel.data.channelDetail.members) {
|
||||
if (member != state.guid) {
|
||||
contacts.push(actions.getCard(member));
|
||||
contacts.push(actions.getCardByGuid(member));
|
||||
}
|
||||
}
|
||||
setMembers(contacts);
|
||||
@ -28,7 +28,7 @@ export function ChannelLogo({ item }) {
|
||||
setHome(true);
|
||||
let contacts = [];
|
||||
for (let member of item.channel.data.channelDetail.members) {
|
||||
contacts.push(actions.getCard(member));
|
||||
contacts.push(actions.getCardByGuid(member));
|
||||
}
|
||||
setMembers(contacts);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export function useChannelLogo() {
|
||||
}
|
||||
return null;
|
||||
},
|
||||
getCard: app?.actions?.getCard,
|
||||
getCardByGuid: app?.actions?.getCardByGuid,
|
||||
};
|
||||
|
||||
const updateState = (value) => {
|
||||
|
@ -15,7 +15,7 @@ export function useChannelItem() {
|
||||
const actions = {
|
||||
select: (item) => {
|
||||
if (item.guid) {
|
||||
navigate(`/user/conversation/${item.guid}/${item.channel.id}`);
|
||||
navigate(`/user/conversation/${item.cardId}/${item.channel.id}`);
|
||||
}
|
||||
else {
|
||||
navigate(`/user/conversation/${item.channel.id}`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user