Skip to content

Commit

Permalink
Merge pull request #30 from 0xs3gfau1t/bijan
Browse files Browse the repository at this point in the history
.
  • Loading branch information
BijanRegmi committed May 21, 2023
2 parents 3083dca + 6ef89e8 commit 097b40a
Show file tree
Hide file tree
Showing 104 changed files with 2,982 additions and 749 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/e-sandesh-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and deploy eSandesh to Azure Web App

on:
push:
branches:
- main
- deploy-server
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: '18.x'

- name: Prepare files
env:
PORT: 80
NEXTAUTH_URL: e-sandesh.azurewebsites.net
run: |
npm install --prefix client
npm run prepare --prefix client
rm -r client/
mv server/* .
rm -r server
npm install
- name: Zip Everything
run: |
zip release.zip ./* -r
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: eSandeshZipped
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: eSandeshZipped
- name: Unzip Artifact
run: unzip release.zip

- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'e-sandesh'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_BACKEND }}
package: release.zip
1 change: 1 addition & 0 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="icon" type="image/png" href="./src/assets/icons/favicon.ico" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<!-- enable below link for english language -->
<link
Expand Down
19 changes: 16 additions & 3 deletions client/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,25 @@ button {
right: 0%;
}
}

.dash-list {
width: 200px;
}
.dash-list li {
@apply px-7 flex gap-2 py-2;
@apply px-4 flex gap-2 py-2 min-w-full;
}
.dash-list li:hover {
opacity: 0.7;
}

.dash-list::-webkit-scrollbar {
display: none;
}

/* For IE, Edge and Firefox */
dash.dash-list {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
.active {
@apply bg-sky-500;
}
Expand Down Expand Up @@ -113,7 +124,9 @@ h6 {
.news-content img {
@apply mb-5;
}

.news-content {
max-width: 40rem;
}
.addNew {
@apply text-white flex gap-4 my-4 mx-auto w-2/4 text-2xl bg-green-700 py-2 px-4 rounded justify-center cursor-pointer;
}
Expand Down
18 changes: 13 additions & 5 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ import {
UserAuth,
ForgotPassword,
Category,
AdsMan,
ViewSiteStats,
Author,
SingleNews,
Landing,
PollsMan,
ManageCritics,
UserProfile,
Polls,
ArchiveNews,
Expand All @@ -24,6 +21,11 @@ import {
} from './pages'

import { PrivateRoute, Alert } from './components/common'
import Register from './pages/Register'
import AboutUs from './pages/AboutUs'
import PrivacyPolicy from './pages/PrivacyPolicy'
import Advertisement from './pages/Advertisement'
import Feedback from './pages/Feedback'

const LazyAdmin = lazy(() => import('./pages/Dashboard/Layout'))
const LazyManageNews = lazy(() => import('./pages/Dashboard/ManageNews'))
Expand Down Expand Up @@ -63,6 +65,7 @@ function App() {
element={<UserAuth session={session} />}
/>
<Route path="/forgotPassword" element={<ForgotPassword />} />
<Route path="/register" element={<Register />} />
<Route path="/admin" element={<Login session={session} />} />
<Route
path="/admin/dashboard"
Expand Down Expand Up @@ -143,10 +146,15 @@ function App() {
<Route path="" element={<Landing />} />
<Route
path="/news/:year/:month/:slug"
element={<SingleNews />}
element={<SingleNews session={session} />}
/>
<Route path="/category/:cat" element={<Category />} />
<Route path="/author/:author" element={<Author />} />
<Route path="search" element={<SearchPage />} />
<Route path="about" element={<AboutUs />} />
<Route path="privacy_policy" element={<PrivacyPolicy />} />
<Route path="advertisement" element={<Advertisement />} />
<Route path="feedback" element={<Feedback />} />
</Route>
<Route path="*" element={<NotFound />} />
</Routes>
Expand Down
File renamed without changes.
63 changes: 35 additions & 28 deletions client/src/components/Comments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
editComments,
likeComment,
} from '../redux/actions/comments'
import { useSession } from 'next-auth/react'

import {
AiOutlineEdit,
AiOutlineLike,
Expand All @@ -16,40 +16,42 @@ import {
AiOutlineDelete,
} from 'react-icons/ai'
import { BiComment, BiCommentAdd } from 'react-icons/bi'
import { MdSend } from 'react-icons/md'

import { getRelativeTime } from '../utils/relativeDuration'
import { setAlert } from '../redux/actions/misc'

const formatter = new Intl.NumberFormat('en-US', { notation: 'compact' })

const AddCommentBox = ({ value, onChange, onSubmit, onCancel }) => {
return (
<form
className="bg-white border border-black rounded-md"
className="bg-white border border-gray-300 rounded-md "
onSubmit={onSubmit}
>
<textarea
className="placeholder:text-slate-400 bg-transparent w-full rounded-md py-2 px-3 shadow-sm focus:outline-none text-sm"
className="bg-transparent w-full rounded-md pt-2 px-3 border border-gray-300 focus:outline-none text-sm text-black placeholder:gray-500 placeholder:text-xl"
onKeyDown={e => {
if (e.key == 'Enter' && e.ctrlKey) onSubmit(e)
else if (e.key == 'Escape') onCancel()
if (e.key === 'Enter' && e.ctrlKey) onSubmit(e)
else if (e.key === 'Escape') onCancel()
}}
rows={2}
rows={4}
required={true}
value={value}
onChange={onChange}
placeholder="What are your thoughts?"
placeholder="आफ्नो विचार लेख्नुहोस्"
/>
<div className="bg-slate-100 py-1 flex flex-row-reverse gap-2 border-t border-solid border-black rounded-b-md px-2">
<input
type="submit"
value="Submit"
className="text-sm font-semibold text-slate-800 cursor-pointer"
/>
<input
<div className="flex justify-end place-items-center">
<button
type="button"
value="Cancel"
onClick={onCancel}
className="text-sm font-semibold text-slate-800 cursor-pointer"
/>
className="ml-2 px-4 h-9 bg-gray-300 text-gray-700 rounded-md hover:bg-gray-400 focus:outline-none"
>
Cancel
</button>
<button type="submit">
<MdSend size={30} className="text-blue-800 text-4xl" />
</button>
</div>
</form>
)
Expand Down Expand Up @@ -235,7 +237,7 @@ const CommentBox = ({
)
}

function Comments({ articleId }) {
function Comments({ articleId, session }) {
const comments = useSelector(state => state.comments.comments)
const dispatch = useDispatch()
const [commenting, setCommenting] = useState({
Expand All @@ -259,8 +261,6 @@ function Comments({ articleId }) {
)
}, [articleId])

const session = useSession()

return (
<div>
<div className="my-2">
Expand Down Expand Up @@ -290,15 +290,22 @@ function Comments({ articleId }) {
}
/>
) : (
<>
<BiCommentAdd
className="inline mr-2"
onClick={() =>
setCommenting({ bool: true, commentStr: '' })
}
/>
<div
className="cursor-pointer"
onClick={() => {
if (session.status == 'unauthenticated')
dispatch(
setAlert(
'You must login to comment!',
'danger'
)
)
else setCommenting({ bool: true, commentStr: '' })
}}
>
<BiCommentAdd className="inline mr-2 " />
<span>Add Comment</span>
</>
</div>
)}
</div>
{comments?.length > 0 && (
Expand Down
37 changes: 10 additions & 27 deletions client/src/components/DashNavs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const TopNav = ({ session }) => {
const [show, setShow] = useState(false)

return (
<div className="place-items-center text-white h-16 bg-darkblue flex border-b-2 border-b-orange-700">
<div className="place-items-center text-white h-16 bg-darkblue flex">
<h1 className="ml-8 my-3 text-2xl">
<SiteLogo theme={'light'} />
</h1>
Expand All @@ -40,10 +40,10 @@ const TopNav = ({ session }) => {
{show && (
<>
<div
className="fixed inset-0 w-full h-full bg-black opacity-10"
className="fixed inset-0 w-full h-full bg-black opacity-10 z-10"
onClick={() => setShow(false)}
></div>
<ul className="header-drop text-black absolute z-99 right-0 mt-32 p-2 w-36 text-center border-blue border-2 rounded-md font-bold text-xl">
<ul className="header-drop text-black absolute z-20 right-0 mt-32 p-2 w-36 text-center border-blue border-2 rounded-md font-bold text-xl">
<hr className="w-11/12 border-neutral-300" />
<NavLink to="/profile/">
<li onClick={e => setShow(false)}>Profile</li>
Expand Down Expand Up @@ -72,31 +72,20 @@ const adminOnly = [
]
const SideNav = ({ role }) => {
return (
<ul className="h-full dash-list flex flex-col gap-8 px-1 py-16 bg-darkblue basis-[14%] flex-grow-0 text-white overflow-y-scroll justify-center">
<NavLink
to={'/admin/dashboard/'}
className={({ isActive }) =>
isActive ? 'bg-sky-600 font-bold' : ''
}
>
<ul className="dash-list flex flex-col py-20 rounded-lg gap-4 bg-darkblue text-white">
<NavLink to={'/admin/dashboard/'}>
<li>
<AiFillFileAdd className=" text-2xl" />
<AiFillFileAdd className="text-xl" />
Manage Articles
</li>
</NavLink>
{role &&
(role?.isRoot || role.canPublish) &&
adminNavs.map(item => {
return (
<NavLink
key={item.url}
to={item.url}
className={({ isActive }) =>
isActive ? 'bg-sky-600 font-bold' : ''
}
>
<NavLink key={item.url} to={item.url}>
<li>
<item.icon className=" text-2xl" />
<item.icon className=" text-xl" />
{item.name}
</li>
</NavLink>
Expand All @@ -105,15 +94,9 @@ const SideNav = ({ role }) => {
{role?.isRoot &&
adminOnly.map(item => {
return (
<NavLink
key={item.url}
to={item.url}
className={({ isActive }) =>
isActive ? 'bg-sky-600 font-bold' : ''
}
>
<NavLink key={item.url} to={item.url}>
<li>
<item.icon className=" text-2xl" />
<item.icon className=" text-xl" />
{item.name}
</li>
</NavLink>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Footer/ImportantLinks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function ImportantLinks() {
</li>

<li className="hover:text-rose-700">
<Link to="/contact">सम्पर्क गर्नुहोस्</Link>
<Link to="/privacy_policy">गोपनीयता नीति</Link>
</li>
</ul>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import React from 'react'
import { BsClock, BsCalendarDay } from 'react-icons/bs'

export default function GoldSilver() {
export default function DateTime() {
return (
<div className="flex place-items-center gap-1">
<div className="flex flex-col gap-2 text-xl text-black">
<BsClock />
<BsCalendarDay />
</div>
<iframe
frameborder="0"
marginwidth="0"
marginheight="0"
allowtransparency="true"
src="https://www.ashesh.com.np/linknepali-time.php?time_only=no&font_color=333333&aj_time=yes&font_size=16&line_brake=1&sec_time=no&nst=no&api=671159n225"
width="195"
Expand Down
Loading

0 comments on commit 097b40a

Please sign in to comment.