dsql-admin/dsql-app/.local_dist/server/pages/contact.js

447 lines
18 KiB
JavaScript
Raw Normal View History

2024-11-06 12:06:51 +00:00
"use strict";
(() => {
var exports = {};
exports.id = 9335;
exports.ids = [9335];
exports.modules = {
/***/ 9144:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"HomepageContext": () => (/* binding */ HomepageContext),
"default": () => (/* binding */ ContactUs)
});
// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(997);
// EXTERNAL MODULE: external "react"
var external_react_ = __webpack_require__(6689);
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
// EXTERNAL MODULE: ./layouts/GeneralLayout.jsx + 1 modules
var GeneralLayout = __webpack_require__(6217);
// EXTERNAL MODULE: ./components/general/PageHeadTags.jsx
var PageHeadTags = __webpack_require__(4097);
// EXTERNAL MODULE: ./functions/frontend/clientAuthUser.js
var clientAuthUser = __webpack_require__(9922);
;// CONCATENATED MODULE: ./components/pages/contact/ContactHero.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
*/ function ContactHero(props) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("section", {
className: "pt-20 pb-0 overflow-visible",
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "w-full max-w-6xl flex-col relative z-10",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("h1", {
className: "m-0",
children: "Contact Us"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "",
children: "We're up all day and ready to help you with anything."
})
]
}),
/*#__PURE__*/ jsx_runtime_.jsx("img", {
src: "/images/grid.webp",
alt: "Dotted image background",
className: "absolute top-0 left-0 w-full object-cover z-0 dark:opacity-20"
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
var fetchApi = __webpack_require__(6729);
// EXTERNAL MODULE: ./components/general/FormAlertBlock.jsx
var FormAlertBlock = __webpack_require__(7037);
// EXTERNAL MODULE: ./components/general/FormSuccessBlock.jsx
var FormSuccessBlock = __webpack_require__(2186);
// EXTERNAL MODULE: ./components/general/LoadingBlock.jsx
var LoadingBlock = __webpack_require__(5264);
;// CONCATENATED MODULE: ./components/pages/contact/ContactForm.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {import("@/package-shared/types").UserType | null} props.user
*/ function ContactForm({ user }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [loading, setLoading] = external_react_default().useState(false);
/** @type {[ alert: string | null, setAlert: React.Dispatch<React.SetStateAction<string | null>> ]} */ // @ts-ignore
const [alert, setAlert] = external_react_default().useState(null);
/** @type {[ successMsg: string | null, setSuccessMsg: React.Dispatch<React.SetStateAction<string | null>> ]} */ // @ts-ignore
const [successMsg, setSuccessMsg] = external_react_default().useState(null);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ jsx_runtime_.jsx("section", {
className: "pt-0",
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("form", {
className: "w-full max-w-none xl:max-w-2xl flex flex-col items-start gap-4 relative bg-white dark:bg-slate-900",
onSubmit: (e)=>{
e.preventDefault();
setLoading(true);
/** @type {HTMLFormElement} */ // @ts-ignore
const formEl = e.target;
(0,fetchApi/* default */.Z)("/api/contact", {
method: "post",
body: {
name: formEl["full_name"].value,
email: formEl["email_address"].value,
message: formEl["message"].value
}
}).then((res)=>{
console.log(res);
setLoading(false);
if (res.success) {
setSuccessMsg("Form Submitted Successfully");
} else {
setAlert(res.msg);
}
});
},
children: [
loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {}),
alert && /*#__PURE__*/ jsx_runtime_.jsx(FormAlertBlock/* default */.Z, {
message: alert
}),
successMsg && /*#__PURE__*/ jsx_runtime_.jsx(FormSuccessBlock/* default */.Z, {
message: successMsg
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("label", {
htmlFor: "full_name",
children: "Full Name"
}),
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
name: "full_name",
id: "full_name",
placeholder: "Full Name",
autoComplete: "name",
defaultValue: user ? user.first_name : "",
required: true
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("label", {
htmlFor: "email_address",
children: "Email Address"
}),
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "email",
name: "email_address",
id: "email_address",
placeholder: "Email Address",
autoComplete: "email",
defaultValue: user ? user.email : "",
required: true
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("label", {
htmlFor: "message",
children: "Message"
}),
/*#__PURE__*/ jsx_runtime_.jsx("textarea", {
name: "message",
id: "message",
cols: 30,
rows: 10,
placeholder: "Write a message",
required: true
})
]
}),
/*#__PURE__*/ jsx_runtime_.jsx("button", {
className: "w-full",
children: "Submit Form"
})
]
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
;// CONCATENATED MODULE: ./pages/contact.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/** ****************************************************************************** */ /** @type {{ user: import("@/package-shared/types").UserType | null}} */ // @ts-ignore
const init = {};
const HomepageContext = /*#__PURE__*/ external_react_default().createContext(init);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
*/ function ContactUs(props) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ if (true) {
external_react_default().useEffect(()=>{
window.location.href = "https://datasquirel.com/contact";
}, []);
return null;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const pageTitle = "Contact Us | Datasquirel";
const pageDescription = "Get in touch";
let head = /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx("title", {
children: pageTitle
}),
/*#__PURE__*/ jsx_runtime_.jsx("meta", {
name: "description",
content: pageDescription
}),
/*#__PURE__*/ jsx_runtime_.jsx(PageHeadTags/* default */.Z, {
pageTitle: pageTitle,
pageDescription: pageDescription,
pagePathname: "/"
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [user, setUser] = external_react_default().useState(null);
external_react_default().useEffect(()=>{
(0,clientAuthUser/* default */.Z)({
setUser
});
}, []);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ jsx_runtime_.jsx(GeneralLayout/* default */.Z, {
head: head,
user: user,
children: /*#__PURE__*/ jsx_runtime_.jsx(HomepageContext.Provider, {
value: {
user
},
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("main", {
className: "overflow-hidden pb-10",
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ContactHero, {}),
/*#__PURE__*/ jsx_runtime_.jsx(ContactForm, {
user: user
})
]
})
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Server Side Props or Static Props
* ==============================================================================
* @type {import("next").GetStaticProps}
*/ // export async function getStaticProps() {
// /**
// * User Auth
// *
// * @description User Auth
// */
// if (process.env.NEXT_PUBLIC_DSQL_LOCAL) {
// return {
// redirect: {
// destination: "https://datasquirel.com/contact",
// permanent: false,
// },
// };
// }
// ////////////////////////////////////////
// ////////////////////////////////////////
// ////////////////////////////////////////
// /**
// * Server props return
// *
// * @description Return data fetched on the server side
// */
// return {
// props: {},
// };
// ////////////////////////////////////////
// ////////////////////////////////////////
// ////////////////////////////////////////
// }
/***/ }),
/***/ 386:
/***/ ((module) => {
module.exports = require("@mui/icons-material/CottageTwoTone");
/***/ }),
/***/ 5557:
/***/ ((module) => {
module.exports = require("@mui/icons-material/MenuBookTwoTone");
/***/ }),
/***/ 2423:
/***/ ((module) => {
module.exports = require("lucide-react");
/***/ }),
/***/ 968:
/***/ ((module) => {
module.exports = require("next/head");
/***/ }),
/***/ 6689:
/***/ ((module) => {
module.exports = require("react");
/***/ }),
/***/ 997:
/***/ ((module) => {
module.exports = require("react/jsx-runtime");
/***/ })
};
;
// load runtime
var __webpack_require__ = require("../webpack-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,913,9360,6217,4097,9922,7037,2186], () => (__webpack_exec__(9144)));
module.exports = __webpack_exports__;
})();