diff --git a/.firebaserc b/.firebaserc index f3d07c94..19b10523 100644 --- a/.firebaserc +++ b/.firebaserc @@ -1,6 +1,7 @@ { "projects": { - "default": "nwplus-ubc" + "default": "nwplus-ubc", + "dev": "nwplus-ubc-dev" }, "targets": { "nwplus-ubc": { @@ -9,6 +10,14 @@ "nw-admin-portal" ] } + }, + "nwplus-ubc-dev": { + "hosting": { + "admin-portal": [ + "dev-nwplus-admin" + ] + } } - } + }, + "etags": {} } \ No newline at end of file diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 7a0130ed..27079953 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -4,17 +4,20 @@ name: Deploy to Firebase Hosting on merge 'on': push: - branches: - - main + branches: [main, dev] + workflow_dispatch: jobs: build_and_deploy: runs-on: ubuntu-latest + env: + IS_PRODUCTION: ${{ endsWith(github.ref, 'main') }} + NODE_OPTIONS: --openssl-legacy-provider steps: - uses: actions/checkout@v3 - name: Use Node.js uses: actions/setup-node@v3 - with: - node-version: '16.x' + - name: Set up Firebase CLI + run: yarn global add firebase-tools - name: Install and Build run: yarn install --frozen-lockfile && yarn build env: @@ -28,7 +31,21 @@ jobs: NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }} SERVICE_ACCOUNT_TOKEN: ${{ secrets.SERVICE_ACCOUNT_TOKEN }} FIREBASE_CLI_PREVIEWS: hostingchannels - - uses: FirebaseExtended/action-hosting-deploy@v0 + # - name: Deploy to dev firebase project + # if: ${{ env.IS_PRODUCTION == 'false' }} + # run: firebase deploy --only hosting:admin-portal --project nwplus-ubc-dev --non-interactive --token ${{ secrets.FIREBASE_TOKEN }} + - name: Deploy to dev firebase project + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' + projectId: nwplus-ubc-dev + target: admin-portal + channelId: live + firebaseToolsVersion: 12.9.1 + - name: Deploy to prod firebase project + if: ${{ env.IS_PRODUCTION == 'true' }} + uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' diff --git a/pages/[id]/HackerInfo.js b/pages/[id]/HackerInfo.js index 667e0a59..0ba417ac 100644 --- a/pages/[id]/HackerInfo.js +++ b/pages/[id]/HackerInfo.js @@ -106,20 +106,9 @@ export default function HackerInfo({ id, hackathons }) { const [currTable, setCurrTable] = useState('Applicants') const [unfilteredTableKeys, setUnfilteredTableKeys] = useState([]) const [filteredTableKeys, setFilteredTableKeys] = useState([]) - const [groupBy, setGroupBy] = useState({ - col1: '', - func: '', - col2: '', - }) - const [where, setWhere] = useState({ - col: '', - func: '', - val: '', - }) - const [sort, setSort] = useState({ - col: '', - direction: '', - }) + const [groupBy, setGroupBy] = useState({ col1: '', func: '', col2: '' }) + const [where, setWhere] = useState({ col: '', func: '', val: '' }) + const [sort, setSort] = useState({ col: '', direction: '' }) const [filter, setFilter] = useState({}) const [calculate, setCalculate] = useState({}) const downloadLink = useRef() @@ -129,9 +118,9 @@ export default function HackerInfo({ id, hackathons }) { const clearFilters = () => { setGroupBy({ col1: '', func: '', col2: '' }) - setFilter({ col: '', func: '', val: '' }) - setSort({ col: '', direction: '' }) setFilter({}) + setSort({ col: '', direction: '' }) + setWhere({ col: '', func: '', val: '' }) } useEffect(() => { @@ -204,7 +193,6 @@ export default function HackerInfo({ id, hackathons }) { const saveWhere = () => { const condition = {} if (['NIS', 'NEQ'].includes(where.func)) { - // negation condition condition.NOT = { [where.func.substring(1)]: { [where.col]: where.func === 'NEQ' ? Number(where.val) : where.val, @@ -231,16 +219,13 @@ export default function HackerInfo({ id, hackathons }) { }) } - - const HackerInfoRow = ({ data }) => { - return ( - - {filteredTableKeys.map(key => ( - {data[key]} - ))} - - ) - } + const HackerInfoRow = ({ data }) => ( + + {filteredTableKeys.map(key => ( + {data[key]} + ))} + + ) const renderTable = useMemo( () => ( @@ -296,7 +281,7 @@ export default function HackerInfo({ id, hackathons }) { {filteredData.map(entry => ( - + ))} @@ -323,13 +308,7 @@ export default function HackerInfo({ id, hackathons }) { ))} - + @@ -344,10 +323,13 @@ export default function HackerInfo({ id, hackathons }) { > cmd-f 2025 Raffle - + - - @@ -437,12 +419,7 @@ export default function HackerInfo({ id, hackathons }) { ))} {groupBy.col1 && groupBy.func && groupBy.col2 && ( -