react-native-langflow-chat
Version:
A native React Native component for integrating LangFlow chat with streaming support, citation bubbles, react-native-marked rendering, and customizable UI
52 lines (51 loc) • 1.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDebugLogger = exports.getTriggerButtonPosition = void 0;
const react_native_1 = require("react-native");
const { width: screenWidth, height: screenHeight } = react_native_1.Dimensions.get("window");
/**
* Calcola la posizione del pulsante trigger in base alla posizione specificata
*/
const getTriggerButtonPosition = (chatPosition) => {
const baseStyle = {
position: "absolute",
zIndex: 1000,
};
switch (chatPosition) {
case "top-left":
return { ...baseStyle, top: 50, left: 20 };
case "top-center":
return { ...baseStyle, top: 50, left: screenWidth / 2 - 30 };
case "top-right":
return { ...baseStyle, top: 50, right: 20 };
case "center-left":
return { ...baseStyle, top: screenHeight / 2 - 30, left: 20 };
case "center-right":
return { ...baseStyle, top: screenHeight / 2 - 30, right: 20 };
case "bottom-left":
return { ...baseStyle, bottom: 50, left: 20 };
case "bottom-center":
return { ...baseStyle, bottom: 50, left: screenWidth / 2 - 30 };
case "bottom-right":
default:
return { ...baseStyle, bottom: 50, right: 20 };
}
};
exports.getTriggerButtonPosition = getTriggerButtonPosition;
/**
* Funzioni di debug condizionale
*/
const createDebugLogger = (debugEnabled) => {
const debugLog = (...args) => {
if (debugEnabled) {
console.log(...args);
}
};
const debugError = (...args) => {
if (debugEnabled) {
console.error(...args);
}
};
return { debugLog, debugError };
};
exports.createDebugLogger = createDebugLogger;