Skip to content

Commit

Permalink
Merge branch 'main' into feat/events-redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
hedyhli committed Mar 16, 2024
2 parents 8584b7d + 0209843 commit dac4652
Show file tree
Hide file tree
Showing 23 changed files with 418 additions and 148 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ jobs:
repository: python-discord/infra
path: infra

- uses: azure/setup-kubectl@v3
- uses: azure/setup-kubectl@v4.0.0

- name: Authenticate with Kubernetes
uses: azure/k8s-set-context@v3
uses: azure/k8s-set-context@v4
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBECONFIG }}
Expand Down
251 changes: 126 additions & 125 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions pydis_site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ for all logic powering our website. Let's go over the directories in detail:
more about our specific apps, see the README inside the app folder itself.

- [`static`](./static) contains our **static files**, such as CSS, JavaScript,
images, and anything else that isn't either content or Python code. Static
files relevant for a specific application are put into subdirectories named
after the application. For example, static files used by the `resources` app go in `static/resources`.
images, and anything else that isn't either content or Python code.

- [`templates`](./templates) contains our **[Django
templates](https://docs.djangoproject.com/en/dev/topics/templates/)**. Like
Expand Down
6 changes: 3 additions & 3 deletions pydis_site/apps/api/models/bot/metricity.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def total_messages(self, user_id: str) -> int:
WHERE
author_id = '%s'
AND NOT is_deleted
AND channel_id != ANY(%s)
AND channel_id != ALL(%s)
""",
[user_id, EXCLUDE_CHANNELS]
)
Expand Down Expand Up @@ -77,7 +77,7 @@ def total_message_blocks(self, user_id: str) -> int:
WHERE
author_id='%s'
AND NOT is_deleted
AND channel_id != ANY(%s)
AND channel_id != ALL(%s)
GROUP BY interval
) block_query;
""",
Expand Down Expand Up @@ -147,7 +147,7 @@ def total_messages_in_past_n_days(
WHERE
author_id = ANY(%s)
AND NOT is_deleted
AND channel_id != ANY(%s)
AND channel_id != ALL(%s)
AND created_at > now() - interval '%s days'
GROUP BY author_id
""",
Expand Down
35 changes: 30 additions & 5 deletions pydis_site/apps/resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,38 @@
This Django application powering the resources list [on our
website](https://www.pythondiscord.com/resources/).

## Directory structure

The main point of interest here lies in the `resources` directory: every
`.yaml` file in here represents a resource that is listed on our website. If
you are looking for the place to suggest new resources, said directory is the
place to create a new YAML file. In regards to the required keys and our
values, it's best to check the other files we have for a reference.
you are looking for the place to add new resources, said directory is the
place to create a new YAML file.

In regards to the required keys and our values, it's best to check the other
files we have for a reference.

Here are some general guidelines:

- The `description` text can include HTML elements, such as a simple bullet-list
to further describe the resource item. Markdown is not yet supported.

- If branding icons (like Goodreads or GitHub through the `icon` field under
`urls`) are included, set `color: dark` rather than `color: black` to ensure it
displays correctly in dark mode.

- For books, please include a link to the Goodreads URL under `urls`.

- If a logo is included, use `icon_image` rather than `title_image` to have the
logo display together next to the title (rather than replacing it). Unless
the logo includes the name of the resources that is clearly visible.

- All images used must be readable in both light and dark modes. If an image does
not suit both themes simultaneously, please include image URLs for each mode
separately using the optional `*_dark` keys:
- `icon_image`, `icon_image_dark`
- `title_image`, `title_image_dark`
- `title_icon`, `title_icon_dark`


## Directory structure

The app has a single view in `views.py` that takes care of reading the `.yaml`
file. This is a standard Django view, mounted in `urls.py` as usual.
Expand Down
8 changes: 7 additions & 1 deletion pydis_site/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@

# Custom settings for django-simple-bulma
BULMA_SETTINGS = {
# NOTE: Due to limitations with Bulma + CSS, it is not possible to
# reference these color variables in our custom CSS files. When changing
# colors here, please do a project-wise grep and make sure other places
# that uses the old color is updated as appropriate.
"variables": {
"primary": "#7289DA", # PyDis blurple
"green": "#32ac66", # Colour picked after Discord discussion
Expand Down Expand Up @@ -331,6 +335,9 @@

"body-background-color": "#252629",

# These black and white colors are flipped so that when using
# has-background-white class for example, a white background is used in
# light mode whereas a dark background is applied in dark mode.
"white": "#2C2F33",
"white-bis": "#23272A ",
"white-ter": "#36393F",
Expand Down Expand Up @@ -371,7 +378,6 @@
"bulma-dropdown",
"bulma-navbar-burger",
],
"fontawesome_token": "ff22cb6f41",
}

# Information about site repository
Expand Down
28 changes: 28 additions & 0 deletions pydis_site/static/css/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Static CSS files

When styling components, oftentimes you can make good use of Bulma classes
rather than hardcoding CSS rules:

- [Bulma color helpers](https://bulma.io/documentation/helpers/color-helpers/):
Classes that can be added to pretty much all Bulma components to give them a
text or background color which are defined in [`BULMA_SETTINGS`](../settings.py).
- [Bulma typography helpers](https://bulma.io/documentation/helpers/typography-helpers/):
Classes you can add to divs and text elements to adjust the text properties
and alignment.
- [Bulma visibility helpers](https://bulma.io/documentation/helpers/visibility-helpers/):
Rather than hardcoding screen width cutoffs just to adjust visibility, use
these classes instead as they are more descriptive and provide more
flexibility.

To adjust Bulma variables (including color, sizes, margins) for a Bulma class
everywhere, adjust the variables in [`BULMA_SETTINGS`](../../settings.py) where
applicable. The [Bulma
Variables](https://bulma.io/documentation/customize/variables/) page describes
the list of all variables and their default values.

That said, however, sometimes Bulma does not provide a good generalized
solution for a specific use case or for a specific element. In that case, use
CSS selectors to ensure that other elements that should not be styled are not
affected by the rule, and when working with colors, ensure both light and dark
modes are supported. Use `[data-theme="light"]` and `[data-theme="dark"]` to
style elements for specific themes.
165 changes: 165 additions & 0 deletions pydis_site/static/fontawesome/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
Fonticons, Inc. (https://fontawesome.com)

--------------------------------------------------------------------------------

Font Awesome Free License

Font Awesome Free is free, open source, and GPL friendly. You can use it for
commercial projects, open source projects, or really almost whatever you want.
Full Font Awesome Free license: https://fontawesome.com/license/free.

--------------------------------------------------------------------------------

# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)

The Font Awesome Free download is licensed under a Creative Commons
Attribution 4.0 International License and applies to all icons packaged
as SVG and JS file types.

--------------------------------------------------------------------------------

# Fonts: SIL OFL 1.1 License

In the Font Awesome Free download, the SIL OFL license applies to all icons
packaged as web and desktop font files.

Copyright (c) 2023 Fonticons, Inc. (https://fontawesome.com)
with Reserved Font Name: "Font Awesome".

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

SIL OPEN FONT LICENSE
Version 1.1 - 26 February 2007

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting — in part or in whole — any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

--------------------------------------------------------------------------------

# Code: MIT License (https://opensource.org/licenses/MIT)

In the Font Awesome Free download, the MIT license applies to all non-font and
non-icon files.

Copyright 2023 Fonticons, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

--------------------------------------------------------------------------------

# Attribution

Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
Awesome Free files already contain embedded comments with sufficient
attribution, so you shouldn't need to do anything additional when using these
files normally.

We've kept attribution comments terse, so we ask that you do not actively work
to remove them from files, especially code. They're a great way for folks to
learn about Font Awesome.

--------------------------------------------------------------------------------

# Brand Icons

All brand icons are trademarks of their respective owners. The use of these
trademarks does not indicate endorsement of the trademark holder by Font
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
to represent the company, product, or service to which they refer.**
7 changes: 7 additions & 0 deletions pydis_site/static/fontawesome/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Font Awesome 6.5.1

Thanks for downloading Font Awesome! We're so excited you're here.

Our documentation is available online. Just head here:

https://fontawesome.com
10 changes: 10 additions & 0 deletions pydis_site/static/fontawesome/UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Upgrading Guide

See the [changelog](https://fontawesome.com/docs/changelog/) for detailed information about what has changed between versions.

The upgrading guide has moved for version 6 to:

- [Web](https://fontawesome.com/docs/web/setup/upgrade/)
- [Desktop](https://fontawesome.com/docs/desktop/setup/upgrade/)

As always, [submit issues](https://github.com/FortAwesome/Font-Awesome/issues/new) that you run into with this guide or with these upgrades to us.

0 comments on commit dac4652

Please sign in to comment.